puppetfile-resolver 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +201 -0
- data/README.md +169 -0
- data/lib/puppetfile-resolver.rb +7 -0
- data/lib/puppetfile-resolver/cache/base.rb +28 -0
- data/lib/puppetfile-resolver/cache/persistent.rb +50 -0
- data/lib/puppetfile-resolver/data/ruby_ca_certs.pem +3432 -0
- data/lib/puppetfile-resolver/models.rb +8 -0
- data/lib/puppetfile-resolver/models/missing_module_specification.rb +27 -0
- data/lib/puppetfile-resolver/models/module_dependency.rb +55 -0
- data/lib/puppetfile-resolver/models/module_specification.rb +114 -0
- data/lib/puppetfile-resolver/models/puppet_dependency.rb +34 -0
- data/lib/puppetfile-resolver/models/puppet_specification.rb +25 -0
- data/lib/puppetfile-resolver/models/puppetfile_dependency.rb +14 -0
- data/lib/puppetfile-resolver/puppetfile.rb +22 -0
- data/lib/puppetfile-resolver/puppetfile/base_module.rb +62 -0
- data/lib/puppetfile-resolver/puppetfile/document.rb +125 -0
- data/lib/puppetfile-resolver/puppetfile/forge_module.rb +14 -0
- data/lib/puppetfile-resolver/puppetfile/git_module.rb +19 -0
- data/lib/puppetfile-resolver/puppetfile/invalid_module.rb +16 -0
- data/lib/puppetfile-resolver/puppetfile/local_module.rb +14 -0
- data/lib/puppetfile-resolver/puppetfile/parser/errors.rb +19 -0
- data/lib/puppetfile-resolver/puppetfile/parser/r10k_eval.rb +133 -0
- data/lib/puppetfile-resolver/puppetfile/parser/r10k_eval/dsl.rb +51 -0
- data/lib/puppetfile-resolver/puppetfile/parser/r10k_eval/module/forge.rb +50 -0
- data/lib/puppetfile-resolver/puppetfile/parser/r10k_eval/module/git.rb +32 -0
- data/lib/puppetfile-resolver/puppetfile/parser/r10k_eval/module/invalid.rb +27 -0
- data/lib/puppetfile-resolver/puppetfile/parser/r10k_eval/module/local.rb +26 -0
- data/lib/puppetfile-resolver/puppetfile/parser/r10k_eval/module/svn.rb +30 -0
- data/lib/puppetfile-resolver/puppetfile/parser/r10k_eval/puppet_module.rb +36 -0
- data/lib/puppetfile-resolver/puppetfile/svn_module.rb +16 -0
- data/lib/puppetfile-resolver/puppetfile/validation_errors.rb +106 -0
- data/lib/puppetfile-resolver/resolution_provider.rb +182 -0
- data/lib/puppetfile-resolver/resolution_result.rb +30 -0
- data/lib/puppetfile-resolver/resolver.rb +77 -0
- data/lib/puppetfile-resolver/spec_searchers/common.rb +15 -0
- data/lib/puppetfile-resolver/spec_searchers/forge.rb +75 -0
- data/lib/puppetfile-resolver/spec_searchers/git.rb +64 -0
- data/lib/puppetfile-resolver/spec_searchers/local.rb +45 -0
- data/lib/puppetfile-resolver/ui/debug_ui.rb +15 -0
- data/lib/puppetfile-resolver/ui/null_ui.rb +20 -0
- data/lib/puppetfile-resolver/util.rb +23 -0
- data/lib/puppetfile-resolver/version.rb +5 -0
- data/puppetfile-cli.rb +101 -0
- data/spec/spec_helper.rb +48 -0
- data/spec/unit/puppetfile-resolver/puppetfile/document_spec.rb +316 -0
- data/spec/unit/puppetfile-resolver/puppetfile/parser/r10k_eval_spec.rb +460 -0
- data/spec/unit/puppetfile-resolver/resolver_spec.rb +421 -0
- metadata +124 -0
@@ -0,0 +1,421 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'puppetfile-resolver/resolver'
|
4
|
+
require 'puppetfile-resolver/puppetfile'
|
5
|
+
|
6
|
+
describe PuppetfileResolver::Resolver do
|
7
|
+
let(:puppet_version) { nil }
|
8
|
+
let(:subject) { PuppetfileResolver::Resolver.new(puppetfile_document, puppet_version) }
|
9
|
+
let(:cache) { MockLocalModuleCache.new }
|
10
|
+
let(:default_resolve_options) { { cache: cache, module_paths: ['??does/not/exist'] } }
|
11
|
+
let(:resolve_options) { default_resolve_options }
|
12
|
+
|
13
|
+
RSpec.shared_examples 'a resolver flag' do |flag|
|
14
|
+
context "Given a document without the flag" do
|
15
|
+
let(:puppetfile_module) { PuppetfileResolver::Puppetfile::LocalModule.new('module1') }
|
16
|
+
|
17
|
+
it 'should resolve with error' do
|
18
|
+
expect{ subject.resolve(resolve_options) }.to raise_error do |error|
|
19
|
+
expect(error).to be_a(PuppetfileResolver::Puppetfile::DocumentVersionConflictError)
|
20
|
+
expect(error.puppetfile_modules).to eq([puppetfile_module])
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "Given a document with the flag" do
|
26
|
+
let(:puppetfile_module) do
|
27
|
+
PuppetfileResolver::Puppetfile::LocalModule.new('module1').tap { |obj| obj.resolver_flags << flag }
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should resolve without error' do
|
31
|
+
result = subject.resolve(resolve_options)
|
32
|
+
|
33
|
+
expect(result.specifications).to include('module1')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Helper to create an empty, but valid puppetfile document
|
39
|
+
def valid_document(content)
|
40
|
+
PuppetfileResolver::Puppetfile::Document.new(content).tap { |d| d.forge_uri = 'https://foo.local' }
|
41
|
+
end
|
42
|
+
|
43
|
+
before(:each) do
|
44
|
+
# Disable all but the local spec searcher
|
45
|
+
allow(PuppetfileResolver::SpecSearchers::Forge).to receive(:find_all).and_return([])
|
46
|
+
allow(PuppetfileResolver::SpecSearchers::Git).to receive(:find_all).and_return([])
|
47
|
+
allow(PuppetfileResolver::SpecSearchers::Forge).to receive(:module_metadata).and_return({})
|
48
|
+
end
|
49
|
+
|
50
|
+
describe '.resolve' do
|
51
|
+
context 'Given an invalid document' do
|
52
|
+
let(:puppetfile_document) do
|
53
|
+
doc = valid_document('foo')
|
54
|
+
doc.add_module(PuppetfileResolver::Puppetfile::InvalidModule.new('invalid_module'))
|
55
|
+
doc
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'should resolve with error' do
|
59
|
+
expect{ subject.resolve(resolve_options) }.to raise_error(RuntimeError, /is not valid/)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context "Given a document with no modules" do
|
64
|
+
let(:puppetfile_document) { valid_document('foo') }
|
65
|
+
|
66
|
+
it 'should resolve without error' do
|
67
|
+
expect{ subject.resolve(resolve_options) }.to_not raise_error
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'should resolve no modules' do
|
71
|
+
result = subject.resolve(resolve_options)
|
72
|
+
|
73
|
+
modules = result.specifications.select { |_, spec| spec.is_a?(PuppetfileResolver::Models::ModuleSpecification) }
|
74
|
+
expect(modules).to be_empty
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context "Given a document with missing modules" do
|
79
|
+
let(:puppetfile_module) { PuppetfileResolver::Puppetfile::LocalModule.new('missing_module') }
|
80
|
+
let(:puppetfile_document) do
|
81
|
+
doc = valid_document('foo')
|
82
|
+
doc.add_module(puppetfile_module)
|
83
|
+
doc
|
84
|
+
end
|
85
|
+
|
86
|
+
context "and Allow Missing Modules option is true" do
|
87
|
+
let(:resolve_options) { default_resolve_options.merge(allow_missing_modules: true) }
|
88
|
+
|
89
|
+
it 'should resolve without error' do
|
90
|
+
expect{ subject.resolve(resolve_options) }.to_not raise_error
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'should resolve with a missing module specification' do
|
94
|
+
result = subject.resolve(resolve_options)
|
95
|
+
|
96
|
+
modules = result.specifications.select { |_, spec| spec.is_a?(PuppetfileResolver::Models::MissingModuleSpecification) }
|
97
|
+
expect(modules['missing_module']).to_not be_nil
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
context "and Allow Missing Modules option is false" do
|
102
|
+
let(:resolve_options) { default_resolve_options.merge(allow_missing_modules: false) }
|
103
|
+
|
104
|
+
it 'should resolve with error' do
|
105
|
+
expect{ subject.resolve(resolve_options) }.to raise_error do |error|
|
106
|
+
expect(error).to be_a(PuppetfileResolver::Puppetfile::DocumentVersionConflictError)
|
107
|
+
expect(error.puppetfile_modules).to eq([puppetfile_module])
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context "Given a document with missing dependant modules" do
|
114
|
+
let(:puppetfile_module) { PuppetfileResolver::Puppetfile::LocalModule.new('module1') }
|
115
|
+
let(:puppetfile_document) do
|
116
|
+
doc = valid_document('foo')
|
117
|
+
doc.add_module(puppetfile_module)
|
118
|
+
doc
|
119
|
+
end
|
120
|
+
|
121
|
+
before(:each) do
|
122
|
+
cache.add_local_module_spec(
|
123
|
+
'module1',
|
124
|
+
[{ name: 'missing_module', version_requirement: '>= 0' }]
|
125
|
+
)
|
126
|
+
end
|
127
|
+
|
128
|
+
context "and Allow Missing Modules option is true" do
|
129
|
+
let(:resolve_options) { default_resolve_options.merge(allow_missing_modules: true) }
|
130
|
+
|
131
|
+
it 'should resolve without error' do
|
132
|
+
expect{ subject.resolve(resolve_options) }.to_not raise_error
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'should resolve with a missing module specification' do
|
136
|
+
result = subject.resolve(resolve_options)
|
137
|
+
modules = result.specifications.select { |_, spec| spec.is_a?(PuppetfileResolver::Models::MissingModuleSpecification) }
|
138
|
+
expect(modules['missing_module']).to_not be_nil
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'should resolve with a found module specification' do
|
142
|
+
result = subject.resolve(resolve_options)
|
143
|
+
|
144
|
+
modules = result.specifications.select { |_, spec| spec.is_a?(PuppetfileResolver::Models::ModuleSpecification) }
|
145
|
+
expect(modules['module1']).to_not be_nil
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
context "and Allow Missing Modules option is false" do
|
150
|
+
let(:resolve_options) { default_resolve_options.merge(allow_missing_modules: false) }
|
151
|
+
|
152
|
+
it 'should resolve with error' do
|
153
|
+
expect{ subject.resolve(resolve_options) }.to raise_error do |error|
|
154
|
+
expect(error).to be_a(PuppetfileResolver::Puppetfile::DocumentVersionConflictError)
|
155
|
+
expect(error.puppetfile_modules).to eq([puppetfile_module])
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
context "Given a document with unresolvable dependencies" do
|
162
|
+
let(:puppetfile_module1) { PuppetfileResolver::Puppetfile::LocalModule.new('module1') }
|
163
|
+
let(:puppetfile_module2) { PuppetfileResolver::Puppetfile::LocalModule.new('module2') }
|
164
|
+
let(:puppetfile_document) do
|
165
|
+
doc = valid_document('foo')
|
166
|
+
doc.add_module(puppetfile_module1)
|
167
|
+
doc.add_module(puppetfile_module2)
|
168
|
+
doc
|
169
|
+
end
|
170
|
+
|
171
|
+
before(:each) do
|
172
|
+
# Module 1 depends on Module 2, but the version specification makes this not possible
|
173
|
+
cache.add_local_module_spec(
|
174
|
+
'module1',
|
175
|
+
[{ name: 'module2', version_requirement: '>= 2.0.0' }]
|
176
|
+
)
|
177
|
+
cache.add_local_module_spec('module2', [], nil, '1.0.0')
|
178
|
+
end
|
179
|
+
|
180
|
+
context "and Allow Missing Modules option is true" do
|
181
|
+
let(:resolve_options) { default_resolve_options.merge(allow_missing_modules: true) }
|
182
|
+
|
183
|
+
it 'should resolve without error' do
|
184
|
+
expect{ subject.resolve(resolve_options) }.to_not raise_error
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'should resolve ignoring the unresolvable module' do
|
188
|
+
result = subject.resolve(resolve_options)
|
189
|
+
|
190
|
+
expect(result.specifications).to_not include('module2')
|
191
|
+
end
|
192
|
+
|
193
|
+
it 'should resolve with a found module specification' do
|
194
|
+
result = subject.resolve(resolve_options)
|
195
|
+
|
196
|
+
modules = result.specifications.select { |_, spec| spec.is_a?(PuppetfileResolver::Models::ModuleSpecification) }
|
197
|
+
expect(modules['module1']).to_not be_nil
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
context "and Allow Missing Modules option is false" do
|
202
|
+
let(:resolve_options) { default_resolve_options.merge(allow_missing_modules: false) }
|
203
|
+
|
204
|
+
it 'should resolve with error' do
|
205
|
+
expect{ subject.resolve(resolve_options) }.to raise_error do |error|
|
206
|
+
expect(error).to be_a(PuppetfileResolver::Puppetfile::DocumentVersionConflictError)
|
207
|
+
expect(error.puppetfile_modules).to eq([puppetfile_module1, puppetfile_module2])
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
context "Given a document with resolvable dependencies" do
|
214
|
+
let(:puppetfile_document) do
|
215
|
+
doc = valid_document('foo')
|
216
|
+
doc.add_module(PuppetfileResolver::Puppetfile::LocalModule.new('module1'))
|
217
|
+
doc.add_module(PuppetfileResolver::Puppetfile::LocalModule.new('module2'))
|
218
|
+
doc
|
219
|
+
end
|
220
|
+
|
221
|
+
before(:each) do
|
222
|
+
# Module 1 depends on Module 2, and the version specification is possible
|
223
|
+
cache.add_local_module_spec(
|
224
|
+
'module1',
|
225
|
+
[{ name: 'module2', version_requirement: '>= 2.0.0' }]
|
226
|
+
)
|
227
|
+
cache.add_local_module_spec('module2', [], nil, '2.0.0')
|
228
|
+
end
|
229
|
+
|
230
|
+
[true, false].each do |testcase|
|
231
|
+
context "and Allow Missing Modules option is #{testcase}" do
|
232
|
+
let(:resolve_options) { default_resolve_options.merge(allow_missing_modules: testcase) }
|
233
|
+
|
234
|
+
it 'should resolve without error' do
|
235
|
+
expect{ subject.resolve(resolve_options) }.to_not raise_error
|
236
|
+
end
|
237
|
+
|
238
|
+
it 'should resolve with found module specifications' do
|
239
|
+
result = subject.resolve(resolve_options)
|
240
|
+
|
241
|
+
expect(result.specifications).to include('module1')
|
242
|
+
expect(result.specifications).to include('module2')
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
context "Given a document with a resolvable Puppet requirement" do
|
249
|
+
let(:puppet_version) { '3.0.0' }
|
250
|
+
let(:puppetfile_document) do
|
251
|
+
doc = valid_document('foo')
|
252
|
+
doc.add_module(PuppetfileResolver::Puppetfile::LocalModule.new('module1'))
|
253
|
+
doc
|
254
|
+
end
|
255
|
+
|
256
|
+
before(:each) do
|
257
|
+
# Version 1.0 of Module 1 depends Puppet < 2.x
|
258
|
+
cache.add_local_module_spec('module1', [], '< 2.0.0', '1.0.0')
|
259
|
+
# Version 2.0 of Module 1 depends Puppet 3.x
|
260
|
+
cache.add_local_module_spec('module1', [], '>= 3.0.0 < 4.0.0', '2.0.0')
|
261
|
+
# Version 2.1 of Module 1 also depends Puppet 3.x
|
262
|
+
cache.add_local_module_spec('module1', [], '>= 3.0.0 < 4.0.0', '2.1.0')
|
263
|
+
# Version 3.0 of Module 1 depends Puppet 4.x
|
264
|
+
cache.add_local_module_spec('module1', [], '>= 4.0.0 < 5.0.0', '3.0.0')
|
265
|
+
end
|
266
|
+
|
267
|
+
[true, false].each do |testcase|
|
268
|
+
context "and Allow Missing Modules option is #{testcase}" do
|
269
|
+
let(:resolve_options) { default_resolve_options.merge(allow_missing_modules: testcase) }
|
270
|
+
|
271
|
+
it 'should resolve without error' do
|
272
|
+
expect{ subject.resolve(resolve_options) }.to_not raise_error
|
273
|
+
end
|
274
|
+
|
275
|
+
it 'should resolve with the most appropriate specification' do
|
276
|
+
result = subject.resolve(resolve_options)
|
277
|
+
|
278
|
+
expect(result.specifications).to include('module1')
|
279
|
+
expect(result.specifications['module1'].version.to_s).to eq('2.1.0')
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
context "Given a document with a unresolvable Puppet requirement" do
|
286
|
+
let(:puppet_version) { '99.99.99' }
|
287
|
+
let(:puppetfile_module) { PuppetfileResolver::Puppetfile::LocalModule.new('module1') }
|
288
|
+
let(:puppetfile_document) do
|
289
|
+
doc = valid_document('foo')
|
290
|
+
doc.add_module(puppetfile_module)
|
291
|
+
doc
|
292
|
+
end
|
293
|
+
|
294
|
+
before(:each) do
|
295
|
+
# Version 1.0 of Module 1 depends module2
|
296
|
+
cache.add_local_module_spec('module1', [{ name: 'module2', version_requirement: '>= 0' }])
|
297
|
+
cache.add_local_module_spec('module2', [], '< 2.0.0')
|
298
|
+
end
|
299
|
+
|
300
|
+
[true, false].each do |testcase|
|
301
|
+
context "and Allow Missing Modules option is #{testcase}" do
|
302
|
+
let(:resolve_options) { default_resolve_options.merge(allow_missing_modules: testcase) }
|
303
|
+
|
304
|
+
it 'should resolve with error' do
|
305
|
+
expect{ subject.resolve(resolve_options) }.to raise_error do |error|
|
306
|
+
expect(error).to be_a(PuppetfileResolver::Puppetfile::DocumentVersionConflictError)
|
307
|
+
expect(error.puppetfile_modules).to eq([puppetfile_module])
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
context 'Using the resolver flag DISABLE_PUPPET_DEPENDENCY_FLAG' do
|
315
|
+
let(:puppet_version) { '99.99.99' }
|
316
|
+
let(:puppetfile_document) do
|
317
|
+
doc = valid_document('foo')
|
318
|
+
doc.add_module(puppetfile_module)
|
319
|
+
doc
|
320
|
+
end
|
321
|
+
|
322
|
+
before(:each) do
|
323
|
+
# Version 1.0 of Module 1 depends Puppet < 2.x
|
324
|
+
cache.add_local_module_spec('module1', [], '< 2.0.0', '1.0.0')
|
325
|
+
# Version 2.0 of Module 1 depends Puppet 3.x
|
326
|
+
cache.add_local_module_spec('module1', [], '>= 3.0.0 < 4.0.0', '2.0.0')
|
327
|
+
end
|
328
|
+
|
329
|
+
it_behaves_like 'a resolver flag', PuppetfileResolver::Puppetfile::DISABLE_PUPPET_DEPENDENCY_FLAG
|
330
|
+
end
|
331
|
+
|
332
|
+
context 'Using the resolver flag DISABLE_ALL_DEPENDENCIES_FLAG' do
|
333
|
+
# Need to set allow_missing_modules to false so it raises errors
|
334
|
+
let(:resolve_options) { default_resolve_options.merge(allow_missing_modules: false) }
|
335
|
+
let(:puppetfile_document) do
|
336
|
+
doc = valid_document('foo')
|
337
|
+
doc.add_module(puppetfile_module)
|
338
|
+
doc
|
339
|
+
end
|
340
|
+
|
341
|
+
before(:each) do
|
342
|
+
# Module 1 depends on Module 2, but the version specification makes this not possible
|
343
|
+
cache.add_local_module_spec(
|
344
|
+
'module1',
|
345
|
+
[{ name: 'module2', version_requirement: '>= 2.0.0' }]
|
346
|
+
)
|
347
|
+
cache.add_local_module_spec('module2', [], nil, '1.0.0')
|
348
|
+
end
|
349
|
+
|
350
|
+
it_behaves_like 'a resolver flag', PuppetfileResolver::Puppetfile::DISABLE_ALL_DEPENDENCIES_FLAG
|
351
|
+
end
|
352
|
+
|
353
|
+
context "Given a document with an explicit module version that does not exist" do
|
354
|
+
let(:puppet_version) { '3.0.0' }
|
355
|
+
let(:puppetfile_module) { PuppetfileResolver::Puppetfile::LocalModule.new('module1').tap { |m| m.version = '2.0.0' } }
|
356
|
+
let(:puppetfile_document) do
|
357
|
+
doc = valid_document('foo')
|
358
|
+
doc.add_module(puppetfile_module)
|
359
|
+
doc
|
360
|
+
end
|
361
|
+
|
362
|
+
before(:each) do
|
363
|
+
# Only version 1.0 of Module 1
|
364
|
+
cache.add_local_module_spec('module1', [], nil, '1.0.0')
|
365
|
+
end
|
366
|
+
|
367
|
+
[true, false].each do |testcase|
|
368
|
+
context "and Allow Missing Modules option is #{testcase}" do
|
369
|
+
let(:resolve_options) { default_resolve_options.merge(allow_missing_modules: testcase) }
|
370
|
+
|
371
|
+
it 'should resolve with error' do
|
372
|
+
expect{ subject.resolve(resolve_options) }.to raise_error do |error|
|
373
|
+
expect(error).to be_a(PuppetfileResolver::Puppetfile::DocumentVersionConflictError)
|
374
|
+
expect(error.puppetfile_modules).to eq([puppetfile_module])
|
375
|
+
end
|
376
|
+
end
|
377
|
+
end
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
context "Given a document with circular dependencies" do
|
382
|
+
let(:puppetfile_module) { PuppetfileResolver::Puppetfile::LocalModule.new('module1') }
|
383
|
+
let(:puppetfile_document) do
|
384
|
+
doc = valid_document('foo')
|
385
|
+
doc.add_module(puppetfile_module)
|
386
|
+
doc
|
387
|
+
end
|
388
|
+
|
389
|
+
before(:each) do
|
390
|
+
# Module 1 depends on Module 2
|
391
|
+
cache.add_local_module_spec(
|
392
|
+
'module1',
|
393
|
+
[{ name: 'module2', version_requirement: '>= 1.0.0' }]
|
394
|
+
)
|
395
|
+
# Module 2 depends on Module 3
|
396
|
+
cache.add_local_module_spec(
|
397
|
+
'module2',
|
398
|
+
[{ name: 'module3', version_requirement: '>= 1.0.0' }]
|
399
|
+
)
|
400
|
+
# Module 3 depends on Module 1 <--- This causes a circular dependency
|
401
|
+
cache.add_local_module_spec(
|
402
|
+
'module3',
|
403
|
+
[{ name: 'module1', version_requirement: '>= 1.0.0' }]
|
404
|
+
)
|
405
|
+
end
|
406
|
+
|
407
|
+
[true, false].each do |testcase|
|
408
|
+
context "and Allow Missing Modules option is #{testcase}" do
|
409
|
+
let(:resolve_options) { default_resolve_options.merge(allow_missing_modules: testcase) }
|
410
|
+
|
411
|
+
it 'should resolve with error' do
|
412
|
+
expect{ subject.resolve(resolve_options) }.to raise_error do |error|
|
413
|
+
expect(error).to be_a(PuppetfileResolver::Puppetfile::DocumentCircularDependencyError)
|
414
|
+
expect(error.puppetfile_modules).to eq([puppetfile_module])
|
415
|
+
end
|
416
|
+
end
|
417
|
+
end
|
418
|
+
end
|
419
|
+
end
|
420
|
+
end
|
421
|
+
end
|
metadata
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: puppetfile-resolver
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Glenn Sarti
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: molinillo
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.6'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: semantic_puppet
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
description: Resolves the Puppet Modules in a Puppetfile with a full dependency graph,
|
42
|
+
including Puppet version checkspec.
|
43
|
+
email:
|
44
|
+
- glennsarti@users.noreply.github.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- LICENSE
|
50
|
+
- README.md
|
51
|
+
- lib/puppetfile-resolver.rb
|
52
|
+
- lib/puppetfile-resolver/cache/base.rb
|
53
|
+
- lib/puppetfile-resolver/cache/persistent.rb
|
54
|
+
- lib/puppetfile-resolver/data/ruby_ca_certs.pem
|
55
|
+
- lib/puppetfile-resolver/models.rb
|
56
|
+
- lib/puppetfile-resolver/models/missing_module_specification.rb
|
57
|
+
- lib/puppetfile-resolver/models/module_dependency.rb
|
58
|
+
- lib/puppetfile-resolver/models/module_specification.rb
|
59
|
+
- lib/puppetfile-resolver/models/puppet_dependency.rb
|
60
|
+
- lib/puppetfile-resolver/models/puppet_specification.rb
|
61
|
+
- lib/puppetfile-resolver/models/puppetfile_dependency.rb
|
62
|
+
- lib/puppetfile-resolver/puppetfile.rb
|
63
|
+
- lib/puppetfile-resolver/puppetfile/base_module.rb
|
64
|
+
- lib/puppetfile-resolver/puppetfile/document.rb
|
65
|
+
- lib/puppetfile-resolver/puppetfile/forge_module.rb
|
66
|
+
- lib/puppetfile-resolver/puppetfile/git_module.rb
|
67
|
+
- lib/puppetfile-resolver/puppetfile/invalid_module.rb
|
68
|
+
- lib/puppetfile-resolver/puppetfile/local_module.rb
|
69
|
+
- lib/puppetfile-resolver/puppetfile/parser/errors.rb
|
70
|
+
- lib/puppetfile-resolver/puppetfile/parser/r10k_eval.rb
|
71
|
+
- lib/puppetfile-resolver/puppetfile/parser/r10k_eval/dsl.rb
|
72
|
+
- lib/puppetfile-resolver/puppetfile/parser/r10k_eval/module/forge.rb
|
73
|
+
- lib/puppetfile-resolver/puppetfile/parser/r10k_eval/module/git.rb
|
74
|
+
- lib/puppetfile-resolver/puppetfile/parser/r10k_eval/module/invalid.rb
|
75
|
+
- lib/puppetfile-resolver/puppetfile/parser/r10k_eval/module/local.rb
|
76
|
+
- lib/puppetfile-resolver/puppetfile/parser/r10k_eval/module/svn.rb
|
77
|
+
- lib/puppetfile-resolver/puppetfile/parser/r10k_eval/puppet_module.rb
|
78
|
+
- lib/puppetfile-resolver/puppetfile/svn_module.rb
|
79
|
+
- lib/puppetfile-resolver/puppetfile/validation_errors.rb
|
80
|
+
- lib/puppetfile-resolver/resolution_provider.rb
|
81
|
+
- lib/puppetfile-resolver/resolution_result.rb
|
82
|
+
- lib/puppetfile-resolver/resolver.rb
|
83
|
+
- lib/puppetfile-resolver/spec_searchers/common.rb
|
84
|
+
- lib/puppetfile-resolver/spec_searchers/forge.rb
|
85
|
+
- lib/puppetfile-resolver/spec_searchers/git.rb
|
86
|
+
- lib/puppetfile-resolver/spec_searchers/local.rb
|
87
|
+
- lib/puppetfile-resolver/ui/debug_ui.rb
|
88
|
+
- lib/puppetfile-resolver/ui/null_ui.rb
|
89
|
+
- lib/puppetfile-resolver/util.rb
|
90
|
+
- lib/puppetfile-resolver/version.rb
|
91
|
+
- puppetfile-cli.rb
|
92
|
+
- spec/spec_helper.rb
|
93
|
+
- spec/unit/puppetfile-resolver/puppetfile/document_spec.rb
|
94
|
+
- spec/unit/puppetfile-resolver/puppetfile/parser/r10k_eval_spec.rb
|
95
|
+
- spec/unit/puppetfile-resolver/resolver_spec.rb
|
96
|
+
homepage: https://github.com/lingua-pupuli/puppetfile-resolver/
|
97
|
+
licenses:
|
98
|
+
- Apache-2.0
|
99
|
+
metadata: {}
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 2.1.9
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 2.7.7
|
117
|
+
signing_key:
|
118
|
+
specification_version: 4
|
119
|
+
summary: Dependency resolver for Puppetfiles
|
120
|
+
test_files:
|
121
|
+
- spec/spec_helper.rb
|
122
|
+
- spec/unit/puppetfile-resolver/puppetfile/document_spec.rb
|
123
|
+
- spec/unit/puppetfile-resolver/puppetfile/parser/r10k_eval_spec.rb
|
124
|
+
- spec/unit/puppetfile-resolver/resolver_spec.rb
|