librarian-puppet-lmco 0.9.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/LICENSE +20 -0
  4. data/README.md +187 -0
  5. data/bin/librarian-puppet +9 -0
  6. data/lib/librarian/puppet.rb +22 -0
  7. data/lib/librarian/puppet/cli.rb +85 -0
  8. data/lib/librarian/puppet/dsl.rb +16 -0
  9. data/lib/librarian/puppet/environment.rb +54 -0
  10. data/lib/librarian/puppet/extension.rb +47 -0
  11. data/lib/librarian/puppet/lockfile/parser.rb +53 -0
  12. data/lib/librarian/puppet/source.rb +4 -0
  13. data/lib/librarian/puppet/source/forge.rb +348 -0
  14. data/lib/librarian/puppet/source/git.rb +121 -0
  15. data/lib/librarian/puppet/source/githubtarball.rb +249 -0
  16. data/lib/librarian/puppet/source/local.rb +57 -0
  17. data/lib/librarian/puppet/source/path.rb +12 -0
  18. data/lib/librarian/puppet/templates/Puppetfile +10 -0
  19. data/lib/librarian/puppet/version.rb +5 -0
  20. data/vendor/librarian/CHANGELOG.md +224 -0
  21. data/vendor/librarian/Gemfile +6 -0
  22. data/vendor/librarian/MIT-LICENSE +20 -0
  23. data/vendor/librarian/README.md +401 -0
  24. data/vendor/librarian/Rakefile +34 -0
  25. data/vendor/librarian/bin/librarian-chef +7 -0
  26. data/vendor/librarian/bin/librarian-mock +7 -0
  27. data/vendor/librarian/config/cucumber.yaml +1 -0
  28. data/vendor/librarian/features/chef/cli/init.feature +11 -0
  29. data/vendor/librarian/features/chef/cli/install.feature +64 -0
  30. data/vendor/librarian/features/chef/cli/show.feature +77 -0
  31. data/vendor/librarian/features/chef/cli/version.feature +11 -0
  32. data/vendor/librarian/features/support/env.rb +9 -0
  33. data/vendor/librarian/lib/librarian.rb +11 -0
  34. data/vendor/librarian/lib/librarian/action.rb +5 -0
  35. data/vendor/librarian/lib/librarian/action/base.rb +24 -0
  36. data/vendor/librarian/lib/librarian/action/clean.rb +44 -0
  37. data/vendor/librarian/lib/librarian/action/ensure.rb +24 -0
  38. data/vendor/librarian/lib/librarian/action/install.rb +95 -0
  39. data/vendor/librarian/lib/librarian/action/persist_resolution_mixin.rb +51 -0
  40. data/vendor/librarian/lib/librarian/action/resolve.rb +46 -0
  41. data/vendor/librarian/lib/librarian/action/update.rb +44 -0
  42. data/vendor/librarian/lib/librarian/chef.rb +1 -0
  43. data/vendor/librarian/lib/librarian/chef/cli.rb +47 -0
  44. data/vendor/librarian/lib/librarian/chef/dsl.rb +16 -0
  45. data/vendor/librarian/lib/librarian/chef/environment.rb +27 -0
  46. data/vendor/librarian/lib/librarian/chef/extension.rb +9 -0
  47. data/vendor/librarian/lib/librarian/chef/integration/knife.rb +46 -0
  48. data/vendor/librarian/lib/librarian/chef/manifest_reader.rb +59 -0
  49. data/vendor/librarian/lib/librarian/chef/source.rb +4 -0
  50. data/vendor/librarian/lib/librarian/chef/source/git.rb +25 -0
  51. data/vendor/librarian/lib/librarian/chef/source/github.rb +27 -0
  52. data/vendor/librarian/lib/librarian/chef/source/local.rb +69 -0
  53. data/vendor/librarian/lib/librarian/chef/source/path.rb +12 -0
  54. data/vendor/librarian/lib/librarian/chef/source/site.rb +442 -0
  55. data/vendor/librarian/lib/librarian/chef/templates/Cheffile +15 -0
  56. data/vendor/librarian/lib/librarian/cli.rb +223 -0
  57. data/vendor/librarian/lib/librarian/cli/manifest_presenter.rb +93 -0
  58. data/vendor/librarian/lib/librarian/config.rb +7 -0
  59. data/vendor/librarian/lib/librarian/config/database.rb +205 -0
  60. data/vendor/librarian/lib/librarian/config/file_source.rb +47 -0
  61. data/vendor/librarian/lib/librarian/config/hash_source.rb +33 -0
  62. data/vendor/librarian/lib/librarian/config/source.rb +149 -0
  63. data/vendor/librarian/lib/librarian/dependency.rb +147 -0
  64. data/vendor/librarian/lib/librarian/dsl.rb +108 -0
  65. data/vendor/librarian/lib/librarian/dsl/receiver.rb +46 -0
  66. data/vendor/librarian/lib/librarian/dsl/target.rb +171 -0
  67. data/vendor/librarian/lib/librarian/environment.rb +182 -0
  68. data/vendor/librarian/lib/librarian/error.rb +4 -0
  69. data/vendor/librarian/lib/librarian/helpers.rb +13 -0
  70. data/vendor/librarian/lib/librarian/linter/source_linter.rb +55 -0
  71. data/vendor/librarian/lib/librarian/lockfile.rb +29 -0
  72. data/vendor/librarian/lib/librarian/lockfile/compiler.rb +66 -0
  73. data/vendor/librarian/lib/librarian/lockfile/parser.rb +123 -0
  74. data/vendor/librarian/lib/librarian/logger.rb +46 -0
  75. data/vendor/librarian/lib/librarian/manifest.rb +140 -0
  76. data/vendor/librarian/lib/librarian/manifest_set.rb +151 -0
  77. data/vendor/librarian/lib/librarian/mock.rb +1 -0
  78. data/vendor/librarian/lib/librarian/mock/cli.rb +19 -0
  79. data/vendor/librarian/lib/librarian/mock/dsl.rb +15 -0
  80. data/vendor/librarian/lib/librarian/mock/environment.rb +24 -0
  81. data/vendor/librarian/lib/librarian/mock/extension.rb +9 -0
  82. data/vendor/librarian/lib/librarian/mock/source.rb +1 -0
  83. data/vendor/librarian/lib/librarian/mock/source/mock.rb +80 -0
  84. data/vendor/librarian/lib/librarian/mock/source/mock/registry.rb +83 -0
  85. data/vendor/librarian/lib/librarian/resolution.rb +46 -0
  86. data/vendor/librarian/lib/librarian/resolver.rb +81 -0
  87. data/vendor/librarian/lib/librarian/resolver/implementation.rb +223 -0
  88. data/vendor/librarian/lib/librarian/source.rb +2 -0
  89. data/vendor/librarian/lib/librarian/source/basic_api.rb +45 -0
  90. data/vendor/librarian/lib/librarian/source/git.rb +134 -0
  91. data/vendor/librarian/lib/librarian/source/git/repository.rb +217 -0
  92. data/vendor/librarian/lib/librarian/source/local.rb +54 -0
  93. data/vendor/librarian/lib/librarian/source/path.rb +56 -0
  94. data/vendor/librarian/lib/librarian/spec.rb +13 -0
  95. data/vendor/librarian/lib/librarian/spec_change_set.rb +173 -0
  96. data/vendor/librarian/lib/librarian/specfile.rb +17 -0
  97. data/vendor/librarian/lib/librarian/support/abstract_method.rb +21 -0
  98. data/vendor/librarian/lib/librarian/ui.rb +64 -0
  99. data/vendor/librarian/lib/librarian/version.rb +3 -0
  100. data/vendor/librarian/librarian.gemspec +35 -0
  101. data/vendor/librarian/spec/functional/chef/cli_spec.rb +194 -0
  102. data/vendor/librarian/spec/functional/chef/source/git_spec.rb +432 -0
  103. data/vendor/librarian/spec/functional/chef/source/site_spec.rb +266 -0
  104. data/vendor/librarian/spec/functional/source/git/repository_spec.rb +150 -0
  105. data/vendor/librarian/spec/integration/chef/source/git_spec.rb +441 -0
  106. data/vendor/librarian/spec/integration/chef/source/site_spec.rb +217 -0
  107. data/vendor/librarian/spec/support/cli_macro.rb +114 -0
  108. data/vendor/librarian/spec/support/method_patch_macro.rb +30 -0
  109. data/vendor/librarian/spec/support/with_env_macro.rb +20 -0
  110. data/vendor/librarian/spec/unit/action/base_spec.rb +18 -0
  111. data/vendor/librarian/spec/unit/action/clean_spec.rb +102 -0
  112. data/vendor/librarian/spec/unit/action/ensure_spec.rb +37 -0
  113. data/vendor/librarian/spec/unit/action/install_spec.rb +111 -0
  114. data/vendor/librarian/spec/unit/config/database_spec.rb +327 -0
  115. data/vendor/librarian/spec/unit/dependency_spec.rb +212 -0
  116. data/vendor/librarian/spec/unit/dsl_spec.rb +173 -0
  117. data/vendor/librarian/spec/unit/environment_spec.rb +173 -0
  118. data/vendor/librarian/spec/unit/lockfile/parser_spec.rb +162 -0
  119. data/vendor/librarian/spec/unit/lockfile_spec.rb +65 -0
  120. data/vendor/librarian/spec/unit/manifest_set_spec.rb +202 -0
  121. data/vendor/librarian/spec/unit/manifest_spec.rb +36 -0
  122. data/vendor/librarian/spec/unit/mock/source/mock_spec.rb +22 -0
  123. data/vendor/librarian/spec/unit/resolver_spec.rb +233 -0
  124. data/vendor/librarian/spec/unit/source/git_spec.rb +29 -0
  125. data/vendor/librarian/spec/unit/spec_change_set_spec.rb +169 -0
  126. metadata +220 -0
@@ -0,0 +1,22 @@
1
+ require "librarian/mock"
2
+
3
+ module Librarian
4
+ module Mock
5
+ module Source
6
+ describe Mock do
7
+
8
+ let(:env) { Librarian::Mock::Environment.new }
9
+
10
+ describe ".new" do
11
+
12
+ let(:source) { described_class.new(env, "source-a", {}) }
13
+ subject { source }
14
+
15
+ its(:environment) { should_not be_nil }
16
+
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,233 @@
1
+ require 'librarian/resolver'
2
+ require 'librarian/spec_change_set'
3
+ require 'librarian/mock'
4
+
5
+ module Librarian
6
+ describe Resolver do
7
+
8
+ let(:env) { Mock::Environment.new }
9
+ let(:resolver) { env.resolver }
10
+
11
+ context "a simple specfile" do
12
+
13
+ before do
14
+ env.registry :clear => true do
15
+ source 'source-1' do
16
+ spec 'butter', '1.1'
17
+ end
18
+ end
19
+ end
20
+
21
+ let(:spec) do
22
+ env.dsl do
23
+ src 'source-1'
24
+ dep 'butter'
25
+ end
26
+ end
27
+
28
+ let(:resolution) { resolver.resolve(spec) }
29
+
30
+ specify { resolution.should be_correct }
31
+
32
+ end
33
+
34
+ context "a specfile with a dep from one src depending on a dep from another src" do
35
+
36
+ before do
37
+ env.registry :clear => true do
38
+ source 'source-1' do
39
+ spec 'butter', '1.1'
40
+ end
41
+ source 'source-2' do
42
+ spec 'jam', '1.2' do
43
+ dependency 'butter', '>= 1.0'
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ let(:spec) do
50
+ env.dsl do
51
+ src 'source-1'
52
+ src 'source-2' do
53
+ dep 'jam'
54
+ end
55
+ end
56
+ end
57
+
58
+ let(:resolution) { resolver.resolve(spec) }
59
+
60
+ specify { resolution.should be_correct }
61
+
62
+ end
63
+
64
+ context "a specfile with a dep in multiple sources" do
65
+
66
+ before do
67
+ env.registry :clear => true do
68
+ source 'source-1' do
69
+ spec 'butter', '1.0'
70
+ spec 'butter', '1.1'
71
+ end
72
+ source 'source-2' do
73
+ spec 'butter', '1.0'
74
+ spec 'butter', '1.1'
75
+ end
76
+ source 'source-3' do
77
+ spec 'butter', '1.0'
78
+ end
79
+ end
80
+ end
81
+
82
+ let(:spec) do
83
+ env.dsl do
84
+ src 'source-1'
85
+ src 'source-2'
86
+ dep 'butter', '>= 1.1'
87
+ end
88
+ end
89
+
90
+ it "should have the expected number of sources" do
91
+ spec.should have(2).sources
92
+ end
93
+
94
+ let(:resolution) { resolver.resolve(spec) }
95
+
96
+ specify { resolution.should be_correct }
97
+
98
+ it "should have the manifest from the final source with a matching manifest" do
99
+ manifest = resolution.manifests.find{|m| m.name == "butter"}
100
+ manifest.source.name.should == "source-2"
101
+ end
102
+
103
+ end
104
+
105
+ context "a specfile with a dep depending on a nonexistent dep" do
106
+
107
+ before do
108
+ env.registry :clear => true do
109
+ source 'source-1' do
110
+ spec 'jam', '1.2' do
111
+ dependency 'butter', '>= 1.0'
112
+ end
113
+ end
114
+ end
115
+ end
116
+
117
+ let(:spec) do
118
+ env.dsl do
119
+ src 'source-1'
120
+ dep 'jam'
121
+ end
122
+ end
123
+
124
+ let(:resolution) { resolver.resolve(spec) }
125
+
126
+ specify { resolution.should be_nil }
127
+
128
+ end
129
+
130
+ context "a specfile with conflicting constraints" do
131
+
132
+ before do
133
+ env.registry :clear => true do
134
+ source 'source-1' do
135
+ spec 'butter', '1.0'
136
+ spec 'butter', '1.1'
137
+ spec 'jam', '1.2' do
138
+ dependency 'butter', '1.1'
139
+ end
140
+ end
141
+ end
142
+ end
143
+
144
+ let(:spec) do
145
+ env.dsl do
146
+ src 'source-1'
147
+ dep 'butter', '1.0'
148
+ dep 'jam'
149
+ end
150
+ end
151
+
152
+ let(:resolution) { resolver.resolve(spec) }
153
+
154
+ specify { resolution.should be_nil }
155
+
156
+ end
157
+
158
+ context "updating" do
159
+
160
+ it "should not work" do
161
+ env.registry :clear => true do
162
+ source 'source-1' do
163
+ spec 'butter', '1.0'
164
+ spec 'butter', '1.1'
165
+ spec 'jam', '1.2' do
166
+ dependency 'butter'
167
+ end
168
+ end
169
+ end
170
+ first_spec = env.dsl do
171
+ src 'source-1'
172
+ dep 'butter', '1.1'
173
+ dep 'jam'
174
+ end
175
+ first_resolution = resolver.resolve(first_spec)
176
+ first_resolution.should be_correct
177
+ first_manifests = first_resolution.manifests
178
+ first_manifests_index = Hash[first_manifests.map{|m| [m.name, m]}]
179
+ first_manifests_index['butter'].version.to_s.should == '1.1'
180
+
181
+ second_spec = env.dsl do
182
+ src 'source-1'
183
+ dep 'butter', '1.0'
184
+ dep 'jam'
185
+ end
186
+ locked_manifests = ManifestSet.deep_strip(first_manifests, ['butter'])
187
+ second_resolution =resolver.resolve(second_spec, locked_manifests)
188
+ second_resolution.should be_correct
189
+ second_manifests = second_resolution.manifests
190
+ second_manifests_index = Hash[second_manifests.map{|m| [m.name, m]}]
191
+ second_manifests_index['butter'].version.to_s.should == '1.0'
192
+ end
193
+
194
+ end
195
+
196
+ context "a change to the spec" do
197
+
198
+ it "should work" do
199
+ env.registry :clear => true do
200
+ source 'source-1' do
201
+ spec 'butter', '1.0'
202
+ end
203
+ source 'source-2' do
204
+ spec 'butter', '1.0'
205
+ end
206
+ end
207
+ spec = env.dsl do
208
+ src 'source-1'
209
+ dep 'butter'
210
+ end
211
+ lock = resolver.resolve(spec)
212
+ lock.should be_correct
213
+
214
+ spec = env.dsl do
215
+ src 'source-1'
216
+ dep 'butter', :src => 'source-2'
217
+ end
218
+ changes = SpecChangeSet.new(env, spec, lock)
219
+ changes.should_not be_same
220
+ manifests = ManifestSet.new(changes.analyze).to_hash
221
+ manifests.should_not have_key('butter')
222
+ lock = resolver.resolve(spec, changes.analyze)
223
+ lock.should be_correct
224
+ lock.manifests.map{|m| m.name}.should include('butter')
225
+ manifest = lock.manifests.find{|m| m.name == 'butter'}
226
+ manifest.should_not be_nil
227
+ manifest.source.name.should == 'source-2'
228
+ end
229
+
230
+ end
231
+
232
+ end
233
+ end
@@ -0,0 +1,29 @@
1
+ require "librarian"
2
+
3
+ module Librarian
4
+ module Source
5
+ describe Git do
6
+
7
+ let(:env) { Environment.new }
8
+
9
+ describe "validating options for the specfile" do
10
+
11
+ context "with only known options" do
12
+ it "should not raise" do
13
+ expect { described_class.from_spec_args(env, "some://git/repo.git", :ref => "megapatches") }.
14
+ to_not raise_error
15
+ end
16
+ end
17
+
18
+ context "with an unknown option" do
19
+ it "should raise" do
20
+ expect { described_class.from_spec_args(env, "some://git/repo.git", :branch => "megapatches") }.
21
+ to raise_error Error, "unrecognized options: branch"
22
+ end
23
+ end
24
+
25
+ end
26
+
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,169 @@
1
+ require 'librarian'
2
+ require 'librarian/spec_change_set'
3
+ require 'librarian/mock'
4
+
5
+ module Librarian
6
+ describe SpecChangeSet do
7
+
8
+ let(:env) { Mock::Environment.new }
9
+ let(:resolver) { env.resolver }
10
+
11
+ context "a simple root removal" do
12
+
13
+ it "should work" do
14
+ env.registry :clear => true do
15
+ source 'source-1' do
16
+ spec 'butter', '1.0'
17
+ spec 'jam', '1.0'
18
+ end
19
+ end
20
+ spec = env.dsl do
21
+ src 'source-1'
22
+ dep 'butter'
23
+ dep 'jam'
24
+ end
25
+ lock = resolver.resolve(spec)
26
+ lock.should be_correct
27
+
28
+ spec = env.dsl do
29
+ src 'source-1'
30
+ dep 'jam'
31
+ end
32
+ changes = described_class.new(env, spec, lock)
33
+ changes.should_not be_same
34
+
35
+ manifests = ManifestSet.new(changes.analyze).to_hash
36
+ manifests.should have_key('jam')
37
+ manifests.should_not have_key('butter')
38
+ end
39
+
40
+ end
41
+
42
+ context "a simple root add" do
43
+
44
+ it "should work" do
45
+ env.registry :clear => true do
46
+ source 'source-1' do
47
+ spec 'butter', '1.0'
48
+ spec 'jam', '1.0'
49
+ end
50
+ end
51
+ spec = env.dsl do
52
+ src 'source-1'
53
+ dep 'jam'
54
+ end
55
+ lock = resolver.resolve(spec)
56
+ lock.should be_correct
57
+
58
+ spec = env.dsl do
59
+ src 'source-1'
60
+ dep 'butter'
61
+ dep 'jam'
62
+ end
63
+ changes = described_class.new(env, spec, lock)
64
+ changes.should_not be_same
65
+ manifests = ManifestSet.new(changes.analyze).to_hash
66
+ manifests.should have_key('jam')
67
+ manifests.should_not have_key('butter')
68
+ end
69
+
70
+ end
71
+
72
+ context "a simple root change" do
73
+
74
+ context "when the change is consistent" do
75
+
76
+ it "should work" do
77
+ env.registry :clear => true do
78
+ source 'source-1' do
79
+ spec 'butter', '1.0'
80
+ spec 'jam', '1.0'
81
+ spec 'jam', '1.1'
82
+ end
83
+ end
84
+ spec = env.dsl do
85
+ src 'source-1'
86
+ dep 'butter'
87
+ dep 'jam', '= 1.1'
88
+ end
89
+ lock = resolver.resolve(spec)
90
+ lock.should be_correct
91
+
92
+ spec = env.dsl do
93
+ src 'source-1'
94
+ dep 'butter'
95
+ dep 'jam', '>= 1.0'
96
+ end
97
+ changes = described_class.new(env, spec, lock)
98
+ changes.should_not be_same
99
+ manifests = ManifestSet.new(changes.analyze).to_hash
100
+ manifests.should have_key('butter')
101
+ manifests.should have_key('jam')
102
+ end
103
+
104
+ end
105
+
106
+ context "when the change is inconsistent" do
107
+
108
+ it "should work" do
109
+ env.registry :clear => true do
110
+ source 'source-1' do
111
+ spec 'butter', '1.0'
112
+ spec 'jam', '1.0'
113
+ spec 'jam', '1.1'
114
+ end
115
+ end
116
+ spec = env.dsl do
117
+ src 'source-1'
118
+ dep 'butter'
119
+ dep 'jam', '= 1.0'
120
+ end
121
+ lock = resolver.resolve(spec)
122
+ lock.should be_correct
123
+
124
+ spec = env.dsl do
125
+ src 'source-1'
126
+ dep 'butter'
127
+ dep 'jam', '>= 1.1'
128
+ end
129
+ changes = described_class.new(env, spec, lock)
130
+ changes.should_not be_same
131
+ manifests = ManifestSet.new(changes.analyze).to_hash
132
+ manifests.should have_key('butter')
133
+ manifests.should_not have_key('jam')
134
+ end
135
+
136
+ end
137
+
138
+ end
139
+
140
+ context "a simple root source change" do
141
+ it "should work" do
142
+ env.registry :clear => true do
143
+ source 'source-1' do
144
+ spec 'butter', '1.0'
145
+ end
146
+ source 'source-2' do
147
+ spec 'butter', '1.0'
148
+ end
149
+ end
150
+ spec = env.dsl do
151
+ src 'source-1'
152
+ dep 'butter'
153
+ end
154
+ lock = resolver.resolve(spec)
155
+ lock.should be_correct
156
+
157
+ spec = env.dsl do
158
+ src 'source-1'
159
+ dep 'butter', :src => 'source-2'
160
+ end
161
+ changes = described_class.new(env, spec, lock)
162
+ changes.should_not be_same
163
+ manifests = ManifestSet.new(changes.analyze).to_hash
164
+ manifests.should_not have_key('butter')
165
+ end
166
+ end
167
+
168
+ end
169
+ end