r10k 1.5.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +15 -0
  2. data/.travis.yml +0 -1
  3. data/CHANGELOG.mkd +63 -0
  4. data/Gemfile +2 -2
  5. data/README.mkd +1 -10
  6. data/doc/dynamic-environments/configuration.mkd +24 -6
  7. data/doc/dynamic-environments/quickstart.mkd +1 -1
  8. data/integration/Gemfile +1 -1
  9. data/integration/configs/pe/centos-5-64mda +25 -0
  10. data/integration/configs/pe/centos-6-64mda +1 -1
  11. data/integration/configs/pe/centos-7-64mda +1 -1
  12. data/integration/configs/pe/debian-6-64mda +1 -1
  13. data/integration/configs/pe/debian-7-64mda +1 -1
  14. data/integration/configs/pe/redhat-6-64mda +1 -1
  15. data/integration/configs/pe/redhat-7-64mda +1 -1
  16. data/integration/configs/pe/sles-11-64mda +1 -1
  17. data/integration/configs/pe/sles-12-64mda +25 -0
  18. data/integration/configs/pe/ubuntu-1004-64mda +1 -1
  19. data/integration/configs/pe/ubuntu-1204-64mda +1 -1
  20. data/integration/configs/pe/ubuntu-1404-64mda +1 -1
  21. data/integration/files/pre-suite/git_config.pp.erb +19 -0
  22. data/integration/pre-suite/01_git_config.rb +5 -17
  23. data/integration/pre-suite/02_pe_r10k.rb +0 -2
  24. data/integration/scripts/README.mkd +86 -0
  25. data/integration/scripts/setup_r10k_env_centos5.sh +23 -0
  26. data/integration/scripts/setup_r10k_env_centos6.sh +23 -0
  27. data/integration/scripts/setup_r10k_env_rhel7.sh +23 -0
  28. data/integration/scripts/setup_r10k_env_sles11.sh +23 -0
  29. data/integration/scripts/setup_r10k_env_sles12.sh +23 -0
  30. data/integration/scripts/setup_r10k_env_ubuntu1004.sh +23 -0
  31. data/integration/scripts/setup_r10k_env_ubuntu1204.sh +23 -0
  32. data/integration/scripts/setup_r10k_env_ubuntu1404.sh +23 -0
  33. data/integration/tests/basic_functionality/negative/neg_invalid_git_provider.rb +44 -0
  34. data/integration/tests/basic_functionality/rugged_git_provider_with_ssh.rb +106 -0
  35. data/integration/tests/basic_functionality/rugged_git_provider_without_ssh.rb +107 -0
  36. data/integration/tests/git_source/git_source_git.rb +1 -1
  37. data/integration/tests/git_source/git_source_ssh.rb +1 -1
  38. data/integration/tests/git_source/negative/neg_git_unauthorized_https.rb +1 -1
  39. data/integration/tests/git_source/negative/neg_git_unauthorized_ssh.rb +1 -1
  40. data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_basedir.rb +1 -1
  41. data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module.rb +8 -2
  42. data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module_ref.rb +1 -1
  43. data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_remote.rb +1 -1
  44. data/integration/tests/user_scenario/basic_workflow/negative/neg_branch_name_collision.rb +1 -1
  45. data/integration/tests/user_scenario/basic_workflow/negative/neg_disk_full.rb +5 -1
  46. data/integration/tests/user_scenario/basic_workflow/negative/neg_duplicate_module_names.rb +3 -3
  47. data/integration/tests/user_scenario/basic_workflow/negative/neg_invalid_puppet_file.rb +1 -1
  48. data/integration/tests/user_scenario/basic_workflow/negative/neg_read_only.rb +1 -1
  49. data/integration/tests/user_scenario/basic_workflow/single_env_10000_files.rb +4 -0
  50. data/integration/tests/user_scenario/basic_workflow/single_env_large_files.rb +4 -0
  51. data/integration/tests/user_scenario/complex_workflow/multi_env_unamanaged.rb +77 -0
  52. data/integration/tests/user_scenario/complex_workflow/single_env_git_module_update.rb +99 -0
  53. data/lib/r10k/action/deploy/display.rb +0 -1
  54. data/lib/r10k/action/runner.rb +20 -0
  55. data/lib/r10k/cli.rb +0 -3
  56. data/lib/r10k/cli/deploy.rb +0 -3
  57. data/lib/r10k/deployment.rb +1 -7
  58. data/lib/r10k/deployment/config.rb +15 -1
  59. data/lib/r10k/deployment/config/loader.rb +0 -11
  60. data/lib/r10k/environment/git.rb +0 -9
  61. data/lib/r10k/environment/svn.rb +0 -9
  62. data/lib/r10k/errors.rb +0 -3
  63. data/lib/r10k/feature.rb +24 -3
  64. data/lib/r10k/forge/module_release.rb +142 -0
  65. data/lib/r10k/git.rb +32 -11
  66. data/lib/r10k/module/forge.rb +25 -54
  67. data/lib/r10k/module_repository/forge.rb +2 -5
  68. data/lib/r10k/puppetfile.rb +1 -1
  69. data/lib/r10k/util/license.rb +20 -0
  70. data/lib/r10k/version.rb +1 -1
  71. data/lib/shared/puppet_forge/connection.rb +62 -0
  72. data/lib/shared/puppet_forge/error.rb +28 -0
  73. data/lib/shared/puppet_forge/tar.rb +10 -0
  74. data/lib/shared/puppet_forge/tar/mini.rb +81 -0
  75. data/lib/shared/puppet_forge/unpacker.rb +68 -0
  76. data/lib/shared/puppet_forge/v3.rb +13 -0
  77. data/lib/shared/puppet_forge/v3/module.rb +66 -0
  78. data/lib/shared/puppet_forge/v3/module_release.rb +73 -0
  79. data/lib/shared/puppet_forge/version.rb +3 -0
  80. data/r10k.gemspec +2 -2
  81. data/r10k.yaml.example +80 -5
  82. data/spec/spec_helper.rb +0 -12
  83. data/spec/unit/action/runner_spec.rb +53 -0
  84. data/spec/unit/deployment/config/loader_spec.rb +5 -19
  85. data/spec/unit/deployment/config_spec.rb +8 -0
  86. data/spec/unit/deployment_spec.rb +1 -1
  87. data/spec/unit/forge/module_release_spec.rb +130 -0
  88. data/spec/unit/git_spec.rb +5 -5
  89. data/spec/unit/module/forge_spec.rb +66 -116
  90. data/spec/unit/module_repository/forge_spec.rb +35 -5
  91. data/spec/unit/module_spec.rb +10 -10
  92. data/spec/unit/puppet_forge/connection_spec.rb +41 -0
  93. data/spec/unit/puppet_forge/tar/mini_spec.rb +87 -0
  94. data/spec/unit/puppet_forge/tar_spec.rb +9 -0
  95. data/spec/unit/puppet_forge/unpacker_spec.rb +59 -0
  96. data/spec/unit/puppet_forge/v3/module_release_spec.rb +68 -0
  97. data/spec/unit/puppet_forge/v3/module_spec.rb +67 -0
  98. metadata +48 -112
  99. data/lib/r10k/cli/environment.rb +0 -28
  100. data/lib/r10k/cli/environment/deploy.rb +0 -26
  101. data/lib/r10k/cli/environment/list.rb +0 -23
  102. data/lib/r10k/cli/environment/stale.rb +0 -24
  103. data/lib/r10k/cli/module.rb +0 -29
  104. data/lib/r10k/cli/module/deploy.rb +0 -27
  105. data/lib/r10k/cli/module/list.rb +0 -24
  106. data/lib/r10k/cli/synchronize.rb +0 -27
  107. data/lib/r10k/deployment/basedir.rb +0 -4
  108. data/lib/r10k/deployment/environment.rb +0 -20
  109. data/lib/r10k/deployment/source.rb +0 -37
  110. data/lib/r10k/git/commit.rb +0 -22
  111. data/lib/r10k/git/head.rb +0 -36
  112. data/lib/r10k/git/ref.rb +0 -66
  113. data/lib/r10k/git/remote_head.rb +0 -19
  114. data/lib/r10k/git/repository.rb +0 -158
  115. data/lib/r10k/git/tag.rb +0 -29
  116. data/lib/r10k/git/working_dir.rb +0 -186
  117. data/lib/r10k/registry.rb +0 -4
  118. data/lib/r10k/semver.rb +0 -128
  119. data/lib/r10k/task.rb +0 -12
  120. data/lib/r10k/task/deployment.rb +0 -164
  121. data/lib/r10k/task/environment.rb +0 -31
  122. data/lib/r10k/task/module.rb +0 -19
  123. data/lib/r10k/task/puppetfile.rb +0 -102
  124. data/lib/r10k/task_runner.rb +0 -72
  125. data/lib/r10k/util/monkey_patches.rb +0 -11
  126. data/spec/fixtures/vcr/cassettes/R10K_ModuleRepository_Forge/and_the_expected_version_is_latest/can_fetch_all_versions_of_a_given_module.yml +0 -187
  127. data/spec/fixtures/vcr/cassettes/R10K_ModuleRepository_Forge/and_the_expected_version_is_latest/can_fetch_the_latest_version_of_a_given_module.yml +0 -187
  128. data/spec/fixtures/vcr/cassettes/R10K_ModuleRepository_Forge/and_the_expected_version_is_latest/ignores_deleted_releases.yml +0 -190
  129. data/spec/fixtures/vcr/cassettes/R10K_ModuleRepository_Forge/it_handles_errors_from_forgeapi_puppetlabs_com/raises_an_error_for_a_non-existant_module.yml +0 -34
  130. data/spec/fixtures/vcr/cassettes/R10K_Module_Forge/and_the_expected_version_is_latest/sets_the_expected_version_based_on_the_latest_forge_version.yml +0 -103
  131. data/spec/shared-examples/git-ref.rb +0 -49
  132. data/spec/unit/deployment/environment_spec.rb +0 -25
  133. data/spec/unit/git/commit_spec.rb +0 -34
  134. data/spec/unit/git/head_spec.rb +0 -22
  135. data/spec/unit/git/ref_spec.rb +0 -45
  136. data/spec/unit/git/repository_spec.rb +0 -34
  137. data/spec/unit/git/tag_spec.rb +0 -32
  138. data/spec/unit/git/working_dir_spec.rb +0 -122
  139. data/spec/unit/util/monkey_patches_spec.rb +0 -20
@@ -1,45 +0,0 @@
1
- require 'spec_helper'
2
- require 'r10k/git'
3
-
4
- describe R10K::Git::Ref do
5
-
6
- let(:ref) { 'master' }
7
- let(:repo) { double('git repository') }
8
- subject { described_class.new(ref) }
9
-
10
- describe "fetching the SHA1" do
11
- it "raises an error if there is not a linked repository" do
12
- expect {
13
- subject.sha1
14
- }.to raise_error(ArgumentError, /Cannot resolve .*#{ref}.*: no associated git repository/)
15
- end
16
-
17
- it "raises an error if the SHA1 could not be resolved" do
18
- subject.repository = repo
19
- expect(repo).to receive(:rev_parse).with(ref).and_raise(R10K::Git::UnresolvableRefError, "Couldn't resolve")
20
-
21
- expect {
22
- subject.sha1
23
- }.to raise_error(R10K::Git::UnresolvableRefError)
24
- end
25
-
26
- it "looks up the ref against the linked repository" do
27
- subject.repository = repo
28
- expect(repo).to receive(:rev_parse).with(ref).and_return 'hash'
29
- expect(subject.sha1).to eq 'hash'
30
- end
31
-
32
- it "invokes the #ref method" do
33
- subject.repository = repo
34
- expect(repo).to receive(:rev_parse).with(ref).and_return 'hash'
35
- expect(subject).to receive(:ref).and_return ref
36
- expect(subject.sha1).to eq 'hash'
37
- end
38
- end
39
-
40
- it "can be converted to a string" do
41
- expect(subject.to_s).to eq ref
42
- end
43
-
44
- it_behaves_like "a git ref"
45
- end
@@ -1,34 +0,0 @@
1
- require 'spec_helper'
2
- require 'r10k/git'
3
-
4
- describe R10K::Git::Repository do
5
- include_context "fail on execution"
6
-
7
- describe "remotes" do
8
- let(:output) do
9
- "cache /home/user/.r10k/git/git@github.com-org-org-modules (fetch)\n" +
10
- "cache /home/user/.r10k/git/git@github.com-org-org-modules (push)\n" +
11
- "origin git@github.com:org/org-modules (fetch)\n" +
12
- "origin git@github.com:org/org-modules (push)\n"
13
- end
14
-
15
- it "generates a hash of remote names and remote URLs" do
16
- expect(subject).to receive(:git).with(%w[remote -v], anything).and_return(double(:stdout => output))
17
-
18
- expect(subject.remotes).to eq({
19
- 'cache' => '/home/user/.r10k/git/git@github.com-org-org-modules',
20
- 'origin' => 'git@github.com:org/org-modules',
21
- })
22
- end
23
- end
24
-
25
- describe "tags" do
26
- let(:tags) { %w[0.1.1 0.1.2 0.1.3 0.1.4 0.2.0 0.3.0 2.0.0] }
27
- let(:output) { tags.map {|x| x + "\n"}.join }
28
-
29
- it "returns a list of tags for this repo" do
30
- expect(subject).to receive(:git).with(%w[tag -l], anything).and_return(double(:stdout => output))
31
- expect(subject.tags).to eq(tags)
32
- end
33
- end
34
- end
@@ -1,32 +0,0 @@
1
- require 'spec_helper'
2
- require 'r10k/git'
3
- require 'r10k/git/tag'
4
-
5
- describe R10K::Git::Tag do
6
-
7
- let(:ref) { '0.1.0' }
8
- let(:repo) { double('git repository') }
9
- subject { described_class.new(ref) }
10
-
11
-
12
- describe "determining if the tag can be resolved" do
13
- it "is true if the tag has been fetched" do
14
- expect(repo).to receive(:rev_parse).with(ref).and_return('32f8ec692906783ee60e02e4a4154bc3a87dfeb6')
15
- subject.repository = repo
16
- expect(subject).to be_resolvable
17
- end
18
-
19
- it "is false if the tag cannot be resolved" do
20
- expect(repo).to receive(:rev_parse).with(ref).and_raise(R10K::Git::UnresolvableRefError, :ref => ref)
21
- subject.repository = repo
22
- expect(subject).to_not be_resolvable
23
- end
24
- end
25
-
26
- it "can be converted to a string" do
27
- expect(subject.to_s).to eq ref
28
- end
29
-
30
- it_behaves_like "a git ref"
31
- it_behaves_like "an immutable git ref"
32
- end
@@ -1,122 +0,0 @@
1
- require 'spec_helper'
2
- require 'r10k/git'
3
- require 'r10k/git/working_dir'
4
-
5
- describe R10K::Git::WorkingDir do
6
- include_context "fail on execution"
7
-
8
- describe "initializing" do
9
- it "generates a new cache for the remote" do
10
- wd = described_class.new('master', 'git://github.com/adrienthebo/r10k-fixture-repo', '/some/nonexistent/dir')
11
- expect(wd.cache).to be_kind_of(R10K::Git::Cache)
12
- end
13
-
14
- it "uses the provided ref as the dirname when no dirname is given" do
15
- wd = described_class.new('master', 'git://github.com/adrienthebo/r10k-fixture-repo', '/some/nonexistent/dir')
16
- expect(wd.dirname).to eq('master')
17
- end
18
-
19
- it "uses an explicit dirname when given" do
20
- wd = described_class.new('master', 'git://github.com/adrienthebo/r10k-fixture-repo', '/some/nonexistent/dir', 'mydir')
21
- expect(wd.dirname).to eq('mydir')
22
- end
23
- end
24
-
25
- describe "synchronizing the working directory" do
26
- subject { described_class.new('master', 'git://github.com/adrienthebo/r10k-fixture-repo', '/some/nonexistent/dir') }
27
- it "clones the repository when the repository doesn't exist" do
28
- expect(subject).to receive(:cloned?).and_return false
29
- expect(subject).to receive(:clone)
30
- subject.sync
31
- end
32
-
33
- it "updates the repository when the repository already exists" do
34
- expect(subject).to receive(:cloned?).and_return true
35
- expect(subject).to receive(:update)
36
- subject.sync
37
- end
38
- end
39
-
40
- describe "when cloning a new repository" do
41
- subject { described_class.new('master', 'git://github.com/adrienthebo/r10k-fixture-repo', '/some/nonexistent/dir') }
42
-
43
- before do
44
- allow(subject).to receive(:cloned?).and_return false
45
- end
46
-
47
- it "updates the cache before cloning" do
48
- expect(subject.cache).to receive(:sync)
49
- allow(subject).to receive(:git)
50
- allow(subject).to receive(:checkout)
51
- subject.sync
52
- end
53
-
54
- it "clones the repository and uses the cache git dir as an object reference" do
55
- allow(subject.cache).to receive(:sync)
56
- expect(subject).to receive(:git).with(['clone', '--reference', subject.cache.git_dir,
57
- 'git://github.com/adrienthebo/r10k-fixture-repo',
58
- '/some/nonexistent/dir/master'])
59
- expect(subject).to receive(:git).with(['remote', 'add', 'cache', subject.cache.git_dir],
60
- an_instance_of(Hash))
61
-
62
- expect(subject).to receive(:git).with(['fetch', 'cache'], an_instance_of(Hash))
63
- allow(subject).to receive(:checkout)
64
- subject.sync
65
- end
66
-
67
- it 'checks out the specific ref after the clone' do
68
- allow(subject.cache).to receive(:sync)
69
- allow(subject).to receive(:git)
70
- expect(subject).to receive(:checkout)
71
- subject.sync
72
- end
73
- end
74
-
75
- describe "updating an existing repository" do
76
- subject { described_class.new('master', 'git://github.com/adrienthebo/r10k-fixture-repo', '/some/nonexistent/dir') }
77
-
78
- before do
79
- allow(subject).to receive(:cloned?).and_return true
80
- end
81
-
82
- it "updates the remotes when they are out of sync" do
83
- allow(subject).to receive(:ref_needs_fetch?).and_return false
84
- allow(subject).to receive(:needs_checkout?).and_return false
85
-
86
- expect(subject).to receive(:update_remotes?).and_return true
87
- expect(subject).to receive(:update_remotes)
88
-
89
- subject.sync
90
- end
91
-
92
- it "updates the cache when the ref requires an update" do
93
- allow(subject).to receive(:update_remotes?).and_return false
94
-
95
- expect(subject).to receive(:ref_needs_fetch?).and_return true
96
- expect(subject).to receive(:fetch_from_cache)
97
- expect(subject).to receive(:checkout).with(an_instance_of(R10K::Git::Ref))
98
-
99
- subject.sync
100
- end
101
-
102
- it "checks out the ref when the wrong commit is checked out" do
103
- allow(subject).to receive(:update_remotes?).and_return false
104
- allow(subject).to receive(:ref_needs_fetch?).and_return false
105
-
106
- expect(subject).to receive(:needs_checkout?).and_return true
107
- expect(subject).to receive(:checkout).with(an_instance_of(R10K::Git::Ref))
108
-
109
- subject.sync
110
- end
111
-
112
- it "doesn't update the repo when everything is in sync" do
113
- allow(subject).to receive(:update_remotes?).and_return false
114
- allow(subject).to receive(:ref_needs_fetch?).and_return false
115
- allow(subject).to receive(:needs_checkout?).and_return false
116
-
117
- expect(subject).to_not receive(:checkout)
118
-
119
- subject.sync
120
- end
121
- end
122
- end
@@ -1,20 +0,0 @@
1
- require 'spec_helper'
2
- require 'r10k/util/monkey_patches'
3
-
4
- describe Symbol, "comparison operator", :if => RUBY_VERSION == '1.8.7' do
5
- it "returns nil if the other value is incomparable" do
6
- expect(:aaa <=> 'bbb').to be_nil
7
- end
8
-
9
- it "returns -1 if the value sorts lower than the compared value" do
10
- expect(:aaa <=> :bbb).to eq(-1)
11
- end
12
-
13
- it "returns 0 if the values are equal" do
14
- expect(:aaa <=> :aaa).to eq(0)
15
- end
16
-
17
- it "returns 1 if the value sorts higher than the compared value" do
18
- expect(:bbb <=> :aaa).to eq(1)
19
- end
20
- end