r10k 3.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitattributes +1 -0
- data/.github/pull_request_template.md +1 -0
- data/.github/workflows/docker.yml +56 -0
- data/.github/workflows/release.yml +36 -0
- data/.gitignore +9 -0
- data/.travis.yml +45 -0
- data/CHANGELOG.mkd +1759 -0
- data/CODEOWNERS +2 -0
- data/CONTRIBUTING.mkd +105 -0
- data/Gemfile +15 -0
- data/LICENSE +14 -0
- data/README.mkd +118 -0
- data/Rakefile +3 -0
- data/azure-pipelines.yml +86 -0
- data/bin/r10k +17 -0
- data/doc/common-patterns.mkd +44 -0
- data/doc/dynamic-environments.mkd +31 -0
- data/doc/dynamic-environments/configuration.mkd +669 -0
- data/doc/dynamic-environments/git-environments.mkd +75 -0
- data/doc/dynamic-environments/introduction.mkd +69 -0
- data/doc/dynamic-environments/master-configuration.mkd +40 -0
- data/doc/dynamic-environments/quickstart.mkd +201 -0
- data/doc/dynamic-environments/svn-environments.mkd +45 -0
- data/doc/dynamic-environments/usage.mkd +132 -0
- data/doc/dynamic-environments/workflow-guide.mkd +247 -0
- data/doc/faq.mkd +164 -0
- data/doc/git/cloning-and-mirroring.mkd +60 -0
- data/doc/git/providers.mkd +111 -0
- data/doc/puppetfile.mkd +309 -0
- data/doc/updating-your-puppetfile.mkd +38 -0
- data/docker/.gitignore +1 -0
- data/docker/.rspec +4 -0
- data/docker/Gemfile +11 -0
- data/docker/Makefile +89 -0
- data/docker/README.md +28 -0
- data/docker/r10k/Dockerfile +67 -0
- data/docker/r10k/adduser.sh +13 -0
- data/docker/r10k/docker-entrypoint.d/10-analytics.sh +30 -0
- data/docker/r10k/docker-entrypoint.sh +11 -0
- data/docker/r10k/release.Dockerfile +54 -0
- data/docker/spec/dockerfile_spec.rb +43 -0
- data/docker/spec/fixtures/Puppetfile +2 -0
- data/integration/Gemfile +19 -0
- data/integration/README.mkd +29 -0
- data/integration/Rakefile +77 -0
- data/integration/component/pre-suite/05_install_dev_r10k.rb +12 -0
- data/integration/files/README.mkd +4 -0
- data/integration/files/hiera.yaml +8 -0
- data/integration/files/modules/helloworld/manifests/init.pp +3 -0
- data/integration/files/modules/hieratest/manifests/init.pp +3 -0
- data/integration/files/modules/unicode/files/pretend_unicode +1 -0
- data/integration/files/modules/unicode/manifests/init.pp +6 -0
- data/integration/files/pre-suite/git_config.pp.erb +19 -0
- data/integration/files/pre-suite/prod_env.config +3 -0
- data/integration/files/r10k_conf.yaml.erb +9 -0
- data/integration/lib/README.mkd +4 -0
- data/integration/lib/git_utils.rb +205 -0
- data/integration/lib/master_manipulator.rb +205 -0
- data/integration/lib/r10k_utils.rb +222 -0
- data/integration/manifests/README.mkd +4 -0
- data/integration/pre-suite/00_pe_install.rb +6 -0
- data/integration/pre-suite/10_git_config.rb +48 -0
- data/integration/pre-suite/20_pe_r10k.rb +55 -0
- data/integration/pre-suite/README.mkd +5 -0
- data/integration/tests/Puppetfile/HTTP_PROXY_affects_forge_source.rb +72 -0
- data/integration/tests/Puppetfile/HTTP_PROXY_affects_git_source.rb +70 -0
- data/integration/tests/README.mkd +4 -0
- data/integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb +83 -0
- data/integration/tests/basic_functionality/negative/neg_deploy_with_invalid_r10k_yaml.rb +51 -0
- data/integration/tests/basic_functionality/negative/neg_deploy_with_missing_r10k_yaml.rb +28 -0
- data/integration/tests/basic_functionality/negative/neg_invalid_git_provider.rb +45 -0
- data/integration/tests/basic_functionality/negative/negative_bad_proxy.rb +34 -0
- data/integration/tests/basic_functionality/proxy_specified_in_configuration.rb +103 -0
- data/integration/tests/basic_functionality/proxy_with_pe_only_module.rb +128 -0
- data/integration/tests/basic_functionality/proxy_with_puppetfile.rb +61 -0
- data/integration/tests/basic_functionality/rugged_git_provider_with_ssh.rb +109 -0
- data/integration/tests/basic_functionality/rugged_git_provider_without_ssh.rb +108 -0
- data/integration/tests/command_line/deploy_env_without_mod_update.rb +76 -0
- data/integration/tests/command_line/negative/neg_deploy_env_with_module_update.rb +77 -0
- data/integration/tests/command_line/negative/neg_invalid_cmd_line_arg.rb +23 -0
- data/integration/tests/git_source/HTTP_proxy_and_git_source.rb +70 -0
- data/integration/tests/git_source/git_source_git.rb +128 -0
- data/integration/tests/git_source/git_source_ssh.rb +87 -0
- data/integration/tests/git_source/git_source_submodule.rb +70 -0
- data/integration/tests/git_source/negative/neg_git_broken_remote.rb +38 -0
- data/integration/tests/git_source/negative/neg_git_unauthorized_https.rb +46 -0
- data/integration/tests/git_source/negative/neg_git_unauthorized_ssh.rb +73 -0
- data/integration/tests/git_source/negative/neg_git_unicode_branch.rb +35 -0
- data/integration/tests/i18n/deploy_module_with_unicode_in_file_name.rb +64 -0
- data/integration/tests/purging/content_not_purged_at_root.rb +89 -0
- data/integration/tests/purging/default_purging.rb +125 -0
- data/integration/tests/purging/does_not_purge_files_on_white_list.rb +93 -0
- data/integration/tests/purging/invalid_whitelist_types.rb +63 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_1000_branches.rb +66 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module.rb +111 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module_static.rb +117 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_hiera.rb +100 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_multi_source.rb +133 -0
- data/integration/tests/user_scenario/basic_workflow/multi_source_custom_forge_git_module.rb +161 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_basedir.rb +46 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_forge_module.rb +48 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module.rb +45 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module_ref.rb +43 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_remote.rb +45 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_branch_name_collision.rb +64 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_disk_full.rb +75 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_duplicate_module_names.rb +44 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_inaccessible_forge.rb +58 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_invalid_env_name.rb +34 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_invalid_puppet_file.rb +36 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_module_specified_at_deleted_release.rb +49 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_read_only.rb +58 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb +51 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_10000_files.rb +75 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_git_module.rb +104 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_module.rb +81 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_module.rb +49 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_large_files.rb +75 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_module_already_installed.rb +82 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_module_last_release_deleted.rb +68 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_non-existent_base_dir.rb +94 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_purge_unmanaged_modules.rb +93 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_switch_forge_git_module.rb +117 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_unicode_paths.rb +60 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_upgrade_forge_mod_revert_change.rb +166 -0
- data/integration/tests/user_scenario/complex_workflow/multi_env_add_change_remove.rb +163 -0
- data/integration/tests/user_scenario/complex_workflow/multi_env_remove_re-add.rb +111 -0
- data/integration/tests/user_scenario/complex_workflow/multi_env_unamanaged.rb +78 -0
- data/integration/tests/user_scenario/complex_workflow/single_env_git_module_update.rb +100 -0
- data/lib/r10k.rb +11 -0
- data/lib/r10k/action/base.rb +31 -0
- data/lib/r10k/action/cri_runner.rb +72 -0
- data/lib/r10k/action/deploy.rb +9 -0
- data/lib/r10k/action/deploy/deploy_helpers.rb +34 -0
- data/lib/r10k/action/deploy/display.rb +89 -0
- data/lib/r10k/action/deploy/environment.rb +196 -0
- data/lib/r10k/action/deploy/module.rb +84 -0
- data/lib/r10k/action/puppetfile.rb +10 -0
- data/lib/r10k/action/puppetfile/check.rb +31 -0
- data/lib/r10k/action/puppetfile/cri_runner.rb +26 -0
- data/lib/r10k/action/puppetfile/install.rb +45 -0
- data/lib/r10k/action/puppetfile/purge.rb +28 -0
- data/lib/r10k/action/runner.rb +96 -0
- data/lib/r10k/action/visitor.rb +31 -0
- data/lib/r10k/cli.rb +51 -0
- data/lib/r10k/cli/deploy.rb +114 -0
- data/lib/r10k/cli/ext/logging.rb +15 -0
- data/lib/r10k/cli/help.rb +7 -0
- data/lib/r10k/cli/puppetfile.rb +74 -0
- data/lib/r10k/cli/version.rb +31 -0
- data/lib/r10k/deployment.rb +132 -0
- data/lib/r10k/deployment/config.rb +56 -0
- data/lib/r10k/environment.rb +37 -0
- data/lib/r10k/environment/bare.rb +16 -0
- data/lib/r10k/environment/base.rb +150 -0
- data/lib/r10k/environment/git.rb +81 -0
- data/lib/r10k/environment/name.rb +86 -0
- data/lib/r10k/environment/svn.rb +91 -0
- data/lib/r10k/environment/with_modules.rb +139 -0
- data/lib/r10k/errors.rb +61 -0
- data/lib/r10k/errors/formatting.rb +28 -0
- data/lib/r10k/feature.rb +56 -0
- data/lib/r10k/feature/collection.rb +23 -0
- data/lib/r10k/features.rb +20 -0
- data/lib/r10k/forge/module_release.rb +228 -0
- data/lib/r10k/git.rb +196 -0
- data/lib/r10k/git/alternates.rb +63 -0
- data/lib/r10k/git/cache.rb +108 -0
- data/lib/r10k/git/errors.rb +34 -0
- data/lib/r10k/git/rugged.rb +17 -0
- data/lib/r10k/git/rugged/bare_repository.rb +85 -0
- data/lib/r10k/git/rugged/base_repository.rb +93 -0
- data/lib/r10k/git/rugged/cache.rb +11 -0
- data/lib/r10k/git/rugged/credentials.rb +91 -0
- data/lib/r10k/git/rugged/thin_repository.rb +89 -0
- data/lib/r10k/git/rugged/working_repository.rb +145 -0
- data/lib/r10k/git/shellgit.rb +9 -0
- data/lib/r10k/git/shellgit/bare_repository.rb +43 -0
- data/lib/r10k/git/shellgit/base_repository.rb +137 -0
- data/lib/r10k/git/shellgit/cache.rb +11 -0
- data/lib/r10k/git/shellgit/thin_repository.rb +69 -0
- data/lib/r10k/git/shellgit/working_repository.rb +111 -0
- data/lib/r10k/git/stateful_repository.rb +95 -0
- data/lib/r10k/initializers.rb +67 -0
- data/lib/r10k/instance_cache.rb +32 -0
- data/lib/r10k/keyed_factory.rb +39 -0
- data/lib/r10k/logging.rb +109 -0
- data/lib/r10k/logging/terminaloutputter.rb +36 -0
- data/lib/r10k/module.rb +38 -0
- data/lib/r10k/module/base.rb +113 -0
- data/lib/r10k/module/forge.rb +177 -0
- data/lib/r10k/module/git.rb +109 -0
- data/lib/r10k/module/local.rb +36 -0
- data/lib/r10k/module/metadata_file.rb +31 -0
- data/lib/r10k/module/svn.rb +112 -0
- data/lib/r10k/puppetfile.rb +286 -0
- data/lib/r10k/settings.rb +194 -0
- data/lib/r10k/settings/collection.rb +123 -0
- data/lib/r10k/settings/container.rb +97 -0
- data/lib/r10k/settings/definition.rb +124 -0
- data/lib/r10k/settings/enum_definition.rb +30 -0
- data/lib/r10k/settings/helpers.rb +38 -0
- data/lib/r10k/settings/list.rb +107 -0
- data/lib/r10k/settings/loader.rb +99 -0
- data/lib/r10k/settings/mixin.rb +54 -0
- data/lib/r10k/settings/uri_definition.rb +19 -0
- data/lib/r10k/source.rb +42 -0
- data/lib/r10k/source/base.rb +74 -0
- data/lib/r10k/source/exec.rb +51 -0
- data/lib/r10k/source/git.rb +142 -0
- data/lib/r10k/source/hash.rb +182 -0
- data/lib/r10k/source/svn.rb +136 -0
- data/lib/r10k/source/yaml.rb +20 -0
- data/lib/r10k/source/yamldir.rb +32 -0
- data/lib/r10k/svn.rb +6 -0
- data/lib/r10k/svn/remote.rb +68 -0
- data/lib/r10k/svn/working_dir.rb +125 -0
- data/lib/r10k/util/attempt.rb +84 -0
- data/lib/r10k/util/basedir.rb +65 -0
- data/lib/r10k/util/commands.rb +31 -0
- data/lib/r10k/util/exec_env.rb +36 -0
- data/lib/r10k/util/license.rb +24 -0
- data/lib/r10k/util/platform.rb +42 -0
- data/lib/r10k/util/purgeable.rb +88 -0
- data/lib/r10k/util/setopts.rb +55 -0
- data/lib/r10k/util/subprocess.rb +84 -0
- data/lib/r10k/util/subprocess/result.rb +56 -0
- data/lib/r10k/util/subprocess/runner.rb +26 -0
- data/lib/r10k/util/subprocess/runner/jruby.rb +23 -0
- data/lib/r10k/util/subprocess/runner/posix.rb +103 -0
- data/lib/r10k/util/subprocess/runner/pump.rb +59 -0
- data/lib/r10k/util/subprocess/runner/windows.rb +23 -0
- data/lib/r10k/util/subprocess/subprocess_error.rb +24 -0
- data/lib/r10k/util/symbolize_keys.rb +35 -0
- data/lib/r10k/version.rb +6 -0
- data/locales/config.yaml +21 -0
- data/locales/r10k.pot +545 -0
- data/r10k.gemspec +50 -0
- data/r10k.yaml.example +112 -0
- data/spec/fixtures/empty/.empty +0 -0
- data/spec/fixtures/integration/git/puppet-boolean-bare.tar +0 -0
- data/spec/fixtures/module/forge/bad_module/metadata.json +1 -0
- data/spec/fixtures/module/forge/eight_hundred/Modulefile +8 -0
- data/spec/fixtures/module/forge/eight_hundred/metadata.json +19 -0
- data/spec/fixtures/unit/action/r10k.yaml +5 -0
- data/spec/fixtures/unit/action/r10k_cachedir.yaml +2 -0
- data/spec/fixtures/unit/action/r10k_generate_types.yaml +3 -0
- data/spec/fixtures/unit/action/r10k_puppet_path.yaml +3 -0
- data/spec/fixtures/unit/puppetfile/argument-error/Puppetfile +1 -0
- data/spec/fixtures/unit/puppetfile/default-branch-override/Puppetfile +5 -0
- data/spec/fixtures/unit/puppetfile/duplicate-module-error/Puppetfile +10 -0
- data/spec/fixtures/unit/puppetfile/invalid-syntax/Puppetfile +1 -0
- data/spec/fixtures/unit/puppetfile/load-error/Puppetfile +1 -0
- data/spec/fixtures/unit/puppetfile/name-error/Puppetfile +1 -0
- data/spec/fixtures/unit/puppetfile/valid-forge-with-version/Puppetfile +1 -0
- data/spec/fixtures/unit/puppetfile/valid-forge-without-version/Puppetfile +1 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/expected_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/subdir_expected_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/subdir_unmanaged_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/unmanaged_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_two/expected_2 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_two/unmanaged_2 +0 -0
- data/spec/fixtures/unit/util/subprocess/runner/no-execute.sh +3 -0
- data/spec/integration/git/rugged/bare_repository_spec.rb +13 -0
- data/spec/integration/git/rugged/thin_repository_spec.rb +14 -0
- data/spec/integration/git/rugged/working_repository_spec.rb +48 -0
- data/spec/integration/git/shellgit/bare_repository_spec.rb +13 -0
- data/spec/integration/git/shellgit/thin_repository_spec.rb +14 -0
- data/spec/integration/git/shellgit/working_repository_spec.rb +13 -0
- data/spec/integration/git/stateful_repository_spec.rb +159 -0
- data/spec/matchers/exit_with.rb +28 -0
- data/spec/matchers/match_realpath.rb +18 -0
- data/spec/r10k-mocks.rb +3 -0
- data/spec/r10k-mocks/mock_config.rb +33 -0
- data/spec/r10k-mocks/mock_env.rb +15 -0
- data/spec/r10k-mocks/mock_source.rb +13 -0
- data/spec/shared-contexts/git-fixtures.rb +55 -0
- data/spec/shared-examples/deploy-actions.rb +69 -0
- data/spec/shared-examples/git-repository.rb +38 -0
- data/spec/shared-examples/git/bare_repository.rb +132 -0
- data/spec/shared-examples/git/thin_repository.rb +26 -0
- data/spec/shared-examples/git/working_repository.rb +207 -0
- data/spec/shared-examples/puppetfile-action.rb +39 -0
- data/spec/shared-examples/settings/ancestry.rb +44 -0
- data/spec/shared-examples/subprocess-runner.rb +83 -0
- data/spec/spec_helper.rb +40 -0
- data/spec/unit/action/cri_runner_spec.rb +72 -0
- data/spec/unit/action/deploy/deploy_helpers_spec.rb +38 -0
- data/spec/unit/action/deploy/display_spec.rb +31 -0
- data/spec/unit/action/deploy/environment_spec.rb +395 -0
- data/spec/unit/action/deploy/module_spec.rb +139 -0
- data/spec/unit/action/puppetfile/check_spec.rb +41 -0
- data/spec/unit/action/puppetfile/cri_runner_spec.rb +47 -0
- data/spec/unit/action/puppetfile/install_spec.rb +84 -0
- data/spec/unit/action/puppetfile/purge_spec.rb +42 -0
- data/spec/unit/action/runner_spec.rb +213 -0
- data/spec/unit/action/visitor_spec.rb +39 -0
- data/spec/unit/cli_spec.rb +9 -0
- data/spec/unit/deployment/config_spec.rb +33 -0
- data/spec/unit/deployment_spec.rb +162 -0
- data/spec/unit/environment/base_spec.rb +109 -0
- data/spec/unit/environment/git_spec.rb +97 -0
- data/spec/unit/environment/name_spec.rb +135 -0
- data/spec/unit/environment/svn_spec.rb +133 -0
- data/spec/unit/errors/formatting_spec.rb +84 -0
- data/spec/unit/feature_spec.rb +50 -0
- data/spec/unit/forge/module_release_spec.rb +213 -0
- data/spec/unit/git/alternates_spec.rb +116 -0
- data/spec/unit/git/cache_spec.rb +55 -0
- data/spec/unit/git/rugged/cache_spec.rb +29 -0
- data/spec/unit/git/rugged/credentials_spec.rb +109 -0
- data/spec/unit/git/shellgit/cache_spec.rb +27 -0
- data/spec/unit/git/stateful_repository_spec.rb +40 -0
- data/spec/unit/git_spec.rb +102 -0
- data/spec/unit/initializers_spec.rb +68 -0
- data/spec/unit/instance_cache_spec.rb +78 -0
- data/spec/unit/keyed_factory_spec.rb +51 -0
- data/spec/unit/logging/terminaloutputter_spec.rb +53 -0
- data/spec/unit/logging_spec.rb +68 -0
- data/spec/unit/module/base_spec.rb +72 -0
- data/spec/unit/module/forge_spec.rb +207 -0
- data/spec/unit/module/git_spec.rb +274 -0
- data/spec/unit/module/metadata_file_spec.rb +68 -0
- data/spec/unit/module/svn_spec.rb +178 -0
- data/spec/unit/module_spec.rb +29 -0
- data/spec/unit/puppetfile_spec.rb +300 -0
- data/spec/unit/settings/collection_spec.rb +123 -0
- data/spec/unit/settings/container_spec.rb +92 -0
- data/spec/unit/settings/definition_spec.rb +79 -0
- data/spec/unit/settings/enum_definition_spec.rb +20 -0
- data/spec/unit/settings/inheritance_spec.rb +38 -0
- data/spec/unit/settings/list_spec.rb +88 -0
- data/spec/unit/settings/loader_spec.rb +110 -0
- data/spec/unit/settings/uri_definition_spec.rb +23 -0
- data/spec/unit/settings_spec.rb +246 -0
- data/spec/unit/source/base_spec.rb +31 -0
- data/spec/unit/source/exec_spec.rb +81 -0
- data/spec/unit/source/git_spec.rb +185 -0
- data/spec/unit/source/hash_spec.rb +54 -0
- data/spec/unit/source/svn_spec.rb +196 -0
- data/spec/unit/source/yaml_spec.rb +42 -0
- data/spec/unit/source_spec.rb +10 -0
- data/spec/unit/svn/remote_spec.rb +21 -0
- data/spec/unit/svn/working_dir_spec.rb +56 -0
- data/spec/unit/util/attempt_spec.rb +82 -0
- data/spec/unit/util/commands_spec.rb +61 -0
- data/spec/unit/util/exec_env_spec.rb +56 -0
- data/spec/unit/util/purgeable_spec.rb +230 -0
- data/spec/unit/util/setopts_spec.rb +59 -0
- data/spec/unit/util/subprocess/result_spec.rb +36 -0
- data/spec/unit/util/subprocess/runner/posix_spec.rb +7 -0
- data/spec/unit/util/subprocess/runner/pump_spec.rb +79 -0
- data/spec/unit/util/subprocess/runner/windows_spec.rb +7 -0
- data/spec/unit/util/subprocess/subprocess_error_spec.rb +26 -0
- data/spec/unit/util/subprocess_spec.rb +65 -0
- data/spec/unit/util/symbolize_keys_spec.rb +67 -0
- metadata +582 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'r10k/source'
|
3
|
+
|
4
|
+
describe R10K::Source::Hash do
|
5
|
+
|
6
|
+
describe '.valid_environments_hash?' do
|
7
|
+
it "rejects strings" do
|
8
|
+
expect(R10K::Source::Hash.valid_environments_hash?('200 OK'))
|
9
|
+
.to eq false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:environments_hash) do
|
14
|
+
{
|
15
|
+
'production' => {
|
16
|
+
'remote' => 'https://git.example.com/puppet/control-repo.git',
|
17
|
+
'ref' => 'release-141',
|
18
|
+
'modules' => {
|
19
|
+
'puppetlabs-stdlib' => '6.1.0',
|
20
|
+
'puppetlabs-ntp' => '8.1.0',
|
21
|
+
'example-myapp1' => {
|
22
|
+
'git' => 'https://git.example.com/puppet/example-myapp1.git',
|
23
|
+
'ref' => 'v1.3.0'
|
24
|
+
}
|
25
|
+
}
|
26
|
+
},
|
27
|
+
'development' => {
|
28
|
+
'remote' => 'https://git.example.com/puppet/control-repo.git',
|
29
|
+
'ref' => 'master',
|
30
|
+
'modules' => {
|
31
|
+
'puppetlabs-stdlib' => '6.1.0',
|
32
|
+
'puppetlabs-ntp' => '8.1.0',
|
33
|
+
'example-myapp1' => {
|
34
|
+
'git' => 'https://git.example.com/puppet/example-myapp1.git',
|
35
|
+
'ref' => 'v1.3.1'
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "with a prefix" do
|
43
|
+
subject do
|
44
|
+
described_class.new('hashsource', '/some/nonexistent/dir',
|
45
|
+
prefix: 'prefixed', environments: environments_hash)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "prepends environment names with a prefix" do
|
49
|
+
environments = subject.environments
|
50
|
+
expect(environments[0].dirname).to eq 'prefixed_production'
|
51
|
+
expect(environments[1].dirname).to eq 'prefixed_development'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,196 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'r10k/source'
|
3
|
+
|
4
|
+
describe R10K::Source::SVN do
|
5
|
+
|
6
|
+
subject do
|
7
|
+
described_class.new('mysource', '/some/nonexistent/dir',
|
8
|
+
{:remote => 'https://svn-server.site/repo'})
|
9
|
+
end
|
10
|
+
|
11
|
+
it "stores the name" do
|
12
|
+
expect(subject.name).to eq 'mysource'
|
13
|
+
end
|
14
|
+
|
15
|
+
it "stores the basedir" do
|
16
|
+
expect(subject.basedir).to eq '/some/nonexistent/dir'
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
describe "lazily generating environments" do
|
21
|
+
it "generates environments when they have not been loaded" do
|
22
|
+
expect(subject).to receive(:generate_environments).and_return %w[hi]
|
23
|
+
expect(subject.environments).to eq %w[hi]
|
24
|
+
end
|
25
|
+
|
26
|
+
it "doesn't recreate environments if they have already been loaded" do
|
27
|
+
expect(subject).to receive(:generate_environments).once.and_return %w[hi]
|
28
|
+
subject.environments
|
29
|
+
subject.environments
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "eagerly generating environments" do
|
34
|
+
before do
|
35
|
+
allow(subject.svn_remote).to receive(:branches).and_return %w[apache dns robobutler]
|
36
|
+
end
|
37
|
+
|
38
|
+
let(:environments) { subject.generate_environments }
|
39
|
+
|
40
|
+
it "creates an environment for each branch and the trunk" do
|
41
|
+
expect(environments[0].name).to eq 'production'
|
42
|
+
expect(environments[1].name).to eq 'apache'
|
43
|
+
expect(environments[2].name).to eq 'dns'
|
44
|
+
expect(environments[3].name).to eq 'robobutler'
|
45
|
+
end
|
46
|
+
|
47
|
+
it "maps trunk to production" do
|
48
|
+
expect(environments[0].remote).to eq 'https://svn-server.site/repo/trunk'
|
49
|
+
end
|
50
|
+
|
51
|
+
it "sets the remote for branch environments to subdirectories of the branches/ directory" do
|
52
|
+
expect(environments[1].remote).to eq 'https://svn-server.site/repo/branches/apache'
|
53
|
+
expect(environments[2].remote).to eq 'https://svn-server.site/repo/branches/dns'
|
54
|
+
expect(environments[3].remote).to eq 'https://svn-server.site/repo/branches/robobutler'
|
55
|
+
end
|
56
|
+
|
57
|
+
it "uses the branch name as the directory by default" do
|
58
|
+
expect(environments[0].dirname).to eq 'production'
|
59
|
+
expect(environments[1].dirname).to eq 'apache'
|
60
|
+
expect(environments[2].dirname).to eq 'dns'
|
61
|
+
expect(environments[3].dirname).to eq 'robobutler'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "generate_environments respects ignore_branch_prefixes setting" do
|
66
|
+
before do
|
67
|
+
allow(subject.svn_remote).to receive(:branches).and_return ['master', 'development', 'not_dev_test_me', 'dev_test', 'dev', 'test_2']
|
68
|
+
subject.instance_variable_set(:@ignore_branch_prefixes, ['dev', 'test'])
|
69
|
+
end
|
70
|
+
|
71
|
+
let(:environments) { subject.generate_environments }
|
72
|
+
|
73
|
+
it "creates an environment for each branch not in ignore_branch_prefixes" do
|
74
|
+
expect(subject.generate_environments.size).to eq(3)
|
75
|
+
end
|
76
|
+
|
77
|
+
it "uses the branch name as the directory by default" do
|
78
|
+
expect(environments[0].name).to eq 'production'
|
79
|
+
expect(environments[1].name).to eq 'master'
|
80
|
+
expect(environments[2].name).to eq 'not_dev_test_me'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe "filtering branches with ignore prefixes" do
|
85
|
+
let(:branches) { ['master', 'development', 'production', 'not_dev_test_me', 'dev_test', 'dev', 'test_2'] }
|
86
|
+
let(:ignore_prefixes) { ['dev', 'test'] }
|
87
|
+
|
88
|
+
it "filters branches" do
|
89
|
+
expect(subject.filter_branches(branches, ignore_prefixes)).to eq(['master', 'production', 'not_dev_test_me'])
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe R10K::Source::SVN, 'when prefixing is enabled' do
|
95
|
+
subject do
|
96
|
+
described_class.new(
|
97
|
+
'mysource',
|
98
|
+
'/some/nonexistent/dir',
|
99
|
+
{
|
100
|
+
:remote => 'https://svn-server.site/repo',
|
101
|
+
:prefix => true
|
102
|
+
}
|
103
|
+
)
|
104
|
+
end
|
105
|
+
|
106
|
+
describe "generating prefixed environments" do
|
107
|
+
before do
|
108
|
+
allow(subject.svn_remote).to receive(:branches).and_return %w[apache dns robobutler]
|
109
|
+
end
|
110
|
+
|
111
|
+
let(:environments) { subject.generate_environments }
|
112
|
+
|
113
|
+
it "creates an environment for each branch and the trunk" do
|
114
|
+
expect(environments.size).to eq(4)
|
115
|
+
end
|
116
|
+
|
117
|
+
it "prefixes the source name to environments" do
|
118
|
+
expect(environments[0].dirname).to eq 'mysource_production'
|
119
|
+
expect(environments[1].dirname).to eq 'mysource_apache'
|
120
|
+
expect(environments[2].dirname).to eq 'mysource_dns'
|
121
|
+
expect(environments[3].dirname).to eq 'mysource_robobutler'
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe R10K::Source::SVN, 'when prefixing is disabled' do
|
127
|
+
subject do
|
128
|
+
described_class.new(
|
129
|
+
'mysource',
|
130
|
+
'/some/nonexistent/dir',
|
131
|
+
{
|
132
|
+
:remote => 'https://svn-server.site/repo',
|
133
|
+
:prefix => false
|
134
|
+
}
|
135
|
+
)
|
136
|
+
end
|
137
|
+
|
138
|
+
describe "generating environments" do
|
139
|
+
before do
|
140
|
+
allow(subject.svn_remote).to receive(:branches).and_return %w[apache dns robobutler]
|
141
|
+
end
|
142
|
+
|
143
|
+
let(:environments) { subject.generate_environments }
|
144
|
+
|
145
|
+
it "creates an environment for each branch and the trunk" do
|
146
|
+
expect(environments.size).to eq(4)
|
147
|
+
end
|
148
|
+
|
149
|
+
it "does not prefix environments" do
|
150
|
+
expect(environments[0].dirname).to eq 'production'
|
151
|
+
expect(environments[1].dirname).to eq 'apache'
|
152
|
+
expect(environments[2].dirname).to eq 'dns'
|
153
|
+
expect(environments[3].dirname).to eq 'robobutler'
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
|
159
|
+
describe R10K::Source::SVN, 'when prefixing is overridden' do
|
160
|
+
subject do
|
161
|
+
described_class.new(
|
162
|
+
'mysource',
|
163
|
+
'/some/nonexistent/dir',
|
164
|
+
{
|
165
|
+
:remote => 'https://svn-server.site/repo',
|
166
|
+
:prefix => "tenant1"
|
167
|
+
}
|
168
|
+
)
|
169
|
+
end
|
170
|
+
|
171
|
+
describe "generating prefixed environments" do
|
172
|
+
before do
|
173
|
+
allow(subject.svn_remote).to receive(:branches).and_return %w[apache dns robobutler]
|
174
|
+
end
|
175
|
+
|
176
|
+
let(:environments) { subject.generate_environments }
|
177
|
+
|
178
|
+
it "creates an environment for each branch and the trunk" do
|
179
|
+
expect(environments.size).to eq(4)
|
180
|
+
end
|
181
|
+
|
182
|
+
it "prefixes the prefix name to environments" do
|
183
|
+
expect(environments[0].dirname).to eq 'tenant1_production'
|
184
|
+
expect(environments[1].dirname).to eq 'tenant1_apache'
|
185
|
+
expect(environments[2].dirname).to eq 'tenant1_dns'
|
186
|
+
expect(environments[3].dirname).to eq 'tenant1_robobutler'
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
|
192
|
+
describe R10K::Source::SVN, 'registering as a source' do
|
193
|
+
it "registers with the :svn key" do
|
194
|
+
expect(R10K::Source.retrieve(:svn)).to eq described_class
|
195
|
+
end
|
196
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'r10k/source'
|
3
|
+
|
4
|
+
describe R10K::Source::Yaml do
|
5
|
+
|
6
|
+
let(:environments_hash) do
|
7
|
+
{
|
8
|
+
'production' => {
|
9
|
+
'remote' => 'https://git.example.com/puppet/control-repo.git',
|
10
|
+
'ref' => 'release-141',
|
11
|
+
'modules' => {
|
12
|
+
'puppetlabs-stdlib' => '6.1.0',
|
13
|
+
'puppetlabs-ntp' => '8.1.0',
|
14
|
+
'example-myapp1' => {
|
15
|
+
'git' => 'https://git.example.com/puppet/example-myapp1.git',
|
16
|
+
'ref' => 'v1.3.0'
|
17
|
+
}
|
18
|
+
}
|
19
|
+
},
|
20
|
+
'development' => {
|
21
|
+
'remote' => 'https://git.example.com/puppet/control-repo.git',
|
22
|
+
'ref' => 'master',
|
23
|
+
'modules' => {
|
24
|
+
'puppetlabs-stdlib' => '6.1.0',
|
25
|
+
'puppetlabs-ntp' => '8.1.0',
|
26
|
+
'example-myapp1' => {
|
27
|
+
'git' => 'https://git.example.com/puppet/example-myapp1.git',
|
28
|
+
'ref' => 'v1.3.1'
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "with valid yaml file" do
|
36
|
+
it "produces environments" do
|
37
|
+
allow(YAML).to receive(:load_file).with('/envs.yaml').and_return(environments_hash)
|
38
|
+
source = described_class.new('yamlsource', '/some/nonexistent/dir', config: '/envs.yaml')
|
39
|
+
expect(source.environments.map(&:name)).to contain_exactly('production', 'development')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'r10k/source'
|
3
|
+
|
4
|
+
describe R10K::Source do
|
5
|
+
it "implementds methods for a keyed factory" do
|
6
|
+
expect(described_class).to respond_to :register
|
7
|
+
expect(described_class).to respond_to :retrieve
|
8
|
+
expect(described_class).to respond_to :generate
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'r10k'
|
2
|
+
require 'r10k/svn'
|
3
|
+
|
4
|
+
describe R10K::SVN::Remote do
|
5
|
+
subject { described_class.new('https://svn-server.site/repo') }
|
6
|
+
|
7
|
+
it "generates the trunk URL by appending '/trunk' to the base URL" do
|
8
|
+
expect(subject.trunk).to eq 'https://svn-server.site/repo/trunk'
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "retrieving branches" do
|
12
|
+
let(:branches) do
|
13
|
+
%[apache/\ndns/\nrobobutler/\nstaging/\n]
|
14
|
+
end
|
15
|
+
|
16
|
+
it "enumerates the /branches directory of the base URL" do
|
17
|
+
allow(subject).to receive(:svn).with(['ls', 'https://svn-server.site/repo/branches']).and_return(branches)
|
18
|
+
expect(subject.branches).to eq(%w[apache dns robobutler staging])
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'r10k/svn/working_dir'
|
3
|
+
|
4
|
+
describe R10K::SVN::WorkingDir, "initializing" do
|
5
|
+
let(:pathname) { Pathname.new("/some/imaginary/path") }
|
6
|
+
it "stores the provided path" do
|
7
|
+
subject = described_class.new(pathname)
|
8
|
+
expect(subject.path).to eq Pathname.new("/some/imaginary/path")
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "when auth is provided" do
|
12
|
+
it "raises an error when only the username is provided" do
|
13
|
+
expect {
|
14
|
+
described_class.new(pathname, :username => "root")
|
15
|
+
}.to raise_error(ArgumentError, "Both username and password must be specified")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "raises an error when only the password is provided" do
|
19
|
+
expect {
|
20
|
+
described_class.new(pathname, :password => "hunter2")
|
21
|
+
}.to raise_error(ArgumentError, "Both username and password must be specified")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "does not raise an error when both username and password are provided" do
|
25
|
+
o = described_class.new(pathname, :username => "root", :password => "hunter2")
|
26
|
+
expect(o.username).to eq("root")
|
27
|
+
expect(o.password).to eq("hunter2")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe R10K::SVN::WorkingDir, "when authentication credentials are given" do
|
33
|
+
let(:pathname) { Pathname.new("/some/imaginary/path") }
|
34
|
+
subject { described_class.new(pathname, :username => "root", :password => "hunter2") }
|
35
|
+
|
36
|
+
def check_args(args)
|
37
|
+
expect(args).to include("--username")
|
38
|
+
expect(args).to include("root")
|
39
|
+
expect(args).to include("--password")
|
40
|
+
expect(args).to include("hunter2")
|
41
|
+
end
|
42
|
+
|
43
|
+
it "invokes 'svn checkout' with the given credentials" do
|
44
|
+
expect(subject).to receive(:svn) do |args, _|
|
45
|
+
check_args(args)
|
46
|
+
end
|
47
|
+
subject.checkout('https://some.svn.url/trunk')
|
48
|
+
end
|
49
|
+
|
50
|
+
it "invokes 'svn update' with the given credentials" do
|
51
|
+
expect(subject).to receive(:svn) do |args, _|
|
52
|
+
check_args(args)
|
53
|
+
end
|
54
|
+
subject.update
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'r10k/util/attempt'
|
3
|
+
|
4
|
+
describe R10K::Util::Attempt do
|
5
|
+
|
6
|
+
describe "with a single truthy value" do
|
7
|
+
subject(:attempt) { described_class.new("hello") }
|
8
|
+
|
9
|
+
it "invokes the next action with the value" do
|
10
|
+
value = nil
|
11
|
+
attempt.try { |inner| value = inner }
|
12
|
+
attempt.run
|
13
|
+
expect(attempt).to be_ok
|
14
|
+
expect(value).to eq "hello"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "returns the resulting value from the block" do
|
18
|
+
attempt.try { |inner| inner + " world" }
|
19
|
+
result = attempt.run
|
20
|
+
expect(attempt).to be_ok
|
21
|
+
expect(result).to eq "hello world"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "with a false value" do
|
26
|
+
subject(:attempt) { described_class.new(nil) }
|
27
|
+
|
28
|
+
it "does not evaluate the block" do
|
29
|
+
value = "outside of block"
|
30
|
+
attempt.try { |inner| value = "ran block" }
|
31
|
+
attempt.run
|
32
|
+
expect(attempt).to be_ok
|
33
|
+
expect(value).to eq "outside of block"
|
34
|
+
end
|
35
|
+
|
36
|
+
it "does not continue execution" do
|
37
|
+
attempt.try { |_| "something" }.try { raise }
|
38
|
+
expect(attempt.run).to be_nil
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "with an array" do
|
43
|
+
subject(:attempt) { described_class.new([1, 2, 3, 4, 5]) }
|
44
|
+
|
45
|
+
it "runs the block for each element in the array" do
|
46
|
+
sum = 0
|
47
|
+
attempt.try { |inner| sum += inner }
|
48
|
+
attempt.run
|
49
|
+
expect(attempt).to be_ok
|
50
|
+
expect(sum).to eq 15
|
51
|
+
end
|
52
|
+
|
53
|
+
it "returns the result of the operation on each array member" do
|
54
|
+
sum = 0
|
55
|
+
attempt.try { |inner| sum += inner }
|
56
|
+
result = attempt.run
|
57
|
+
expect(result).to eq([1, 3, 6, 10, 15])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "when an exception is raised" do
|
62
|
+
subject(:attempt) { described_class.new("initial") }
|
63
|
+
|
64
|
+
it "returns the exception" do
|
65
|
+
attempt.try { |_| raise RuntimeError }
|
66
|
+
result = attempt.run
|
67
|
+
expect(attempt).to_not be_ok
|
68
|
+
expect(result).to be_a_kind_of RuntimeError
|
69
|
+
end
|
70
|
+
|
71
|
+
it "does not continue execution" do
|
72
|
+
attempt.try { |_| raise RuntimeError }.try { |_| "This should not be run" }
|
73
|
+
result = attempt.run
|
74
|
+
expect(result).to be_a_kind_of RuntimeError
|
75
|
+
end
|
76
|
+
|
77
|
+
it "only rescues descendants of StandardError" do
|
78
|
+
attempt.try { |_| raise Exception }
|
79
|
+
expect { attempt.run }.to raise_error(Exception)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|