puppet-library 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.yml +4 -0
- data/lib/puppet_library/forge/multi.rb +27 -5
- data/lib/puppet_library/version.rb +1 -1
- data/spec/forge/multi_spec.rb +40 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3dbf9bee6cd6735e0b70e07f1d99a6f2424100fe
|
4
|
+
data.tar.gz: 55bab3f751e5882efe31ee6e7b1470ae4478e1ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17ff1cb9f1b0eba72702b5e40b97d3c3384f6a33bd869d084615a5e6fbdf28a02e3c327e764d8221fbf7f893c6e9fbede7d62a1e02ddad70e0f045d8d4fffa5c
|
7
|
+
data.tar.gz: 5a63286451d1d0f39cf908725508610a0e26210ac437fc442eeeca1e840d164482b11ac83f59475b8fcc568f239ba1a5180797a97d811364f229234321f100ea
|
data/CHANGELOG.yml
CHANGED
@@ -97,3 +97,7 @@
|
|
97
97
|
- Ignore corrupt module files on disk
|
98
98
|
- Added logging for when module files can't be read from disk
|
99
99
|
- Recurse into module directories when serving modules from disk
|
100
|
+
- tag: v0.16.0
|
101
|
+
changes:
|
102
|
+
- Fix dependency problems across multiple forges (#8)
|
103
|
+
|
@@ -18,6 +18,7 @@
|
|
18
18
|
require 'puppet_library/forge/forge'
|
19
19
|
require 'puppet_library/forge/search_result'
|
20
20
|
require 'puppet_library/util/patches'
|
21
|
+
require 'ostruct'
|
21
22
|
|
22
23
|
module PuppetLibrary::Forge
|
23
24
|
|
@@ -89,14 +90,35 @@ module PuppetLibrary::Forge
|
|
89
90
|
end
|
90
91
|
|
91
92
|
def get_module_metadata_with_dependencies(author, name, version)
|
93
|
+
modules_to_search = [ OpenStruct.new(:author => author, :name => name, :version => version) ]
|
94
|
+
|
95
|
+
already_searched_modules = []
|
96
|
+
|
92
97
|
metadata_list = []
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
+
while spec = modules_to_search.shift
|
99
|
+
if already_searched_modules.include? spec
|
100
|
+
next
|
101
|
+
else
|
102
|
+
already_searched_modules << spec
|
103
|
+
end
|
104
|
+
|
105
|
+
@forges.each do |forge|
|
106
|
+
begin
|
107
|
+
metadata = forge.get_module_metadata_with_dependencies(spec.author, spec.name, spec.version)
|
108
|
+
|
109
|
+
# Search all subforges for all versions of the dependencies too
|
110
|
+
modules_to_search += metadata.keys.map do |dep_full_name|
|
111
|
+
dep_author, dep_name = dep_full_name.split("/")
|
112
|
+
OpenStruct.new(:author => dep_author, :name => dep_name, :version => nil)
|
113
|
+
end
|
114
|
+
|
115
|
+
metadata_list << metadata
|
116
|
+
rescue ModuleNotFound
|
117
|
+
# Try the next one
|
118
|
+
end
|
98
119
|
end
|
99
120
|
end
|
121
|
+
|
100
122
|
raise ModuleNotFound if metadata_list.empty?
|
101
123
|
metadata_list.deep_merge.tap do |metadata|
|
102
124
|
metadata.each do |module_name, releases|
|
data/spec/forge/multi_spec.rb
CHANGED
@@ -258,6 +258,10 @@ module PuppetLibrary::Forge
|
|
258
258
|
end
|
259
259
|
expect(subforge_one).to receive(:get_module_metadata_with_dependencies).with("puppetlabs", "apache", nil).and_return(apache_module_metadata_one)
|
260
260
|
expect(subforge_two).to receive(:get_module_metadata_with_dependencies).with("puppetlabs", "apache", nil).and_return(apache_module_metadata_two)
|
261
|
+
expect(subforge_one).to receive(:get_module_metadata_with_dependencies).with("puppetlabs", "stdlib", nil).and_return({})
|
262
|
+
expect(subforge_two).to receive(:get_module_metadata_with_dependencies).with("puppetlabs", "stdlib", nil).and_return({})
|
263
|
+
expect(subforge_one).to receive(:get_module_metadata_with_dependencies).with("puppetlabs", "concat", nil).and_return({})
|
264
|
+
expect(subforge_two).to receive(:get_module_metadata_with_dependencies).with("puppetlabs", "concat", nil).and_return({})
|
261
265
|
|
262
266
|
metadata = multi_forge.get_module_metadata_with_dependencies("puppetlabs", "apache", nil)
|
263
267
|
|
@@ -313,6 +317,10 @@ module PuppetLibrary::Forge
|
|
313
317
|
end
|
314
318
|
expect(subforge_one).to receive(:get_module_metadata_with_dependencies).with("puppetlabs", "apache", nil).and_return(apache_module_metadata_one)
|
315
319
|
expect(subforge_two).to receive(:get_module_metadata_with_dependencies).with("puppetlabs", "apache", nil).and_return(apache_module_metadata_two)
|
320
|
+
expect(subforge_one).to receive(:get_module_metadata_with_dependencies).with("puppetlabs", "stdlib", nil).and_return({})
|
321
|
+
expect(subforge_two).to receive(:get_module_metadata_with_dependencies).with("puppetlabs", "stdlib", nil).and_return({})
|
322
|
+
expect(subforge_one).to receive(:get_module_metadata_with_dependencies).with("puppetlabs", "concat", nil).and_return({})
|
323
|
+
expect(subforge_two).to receive(:get_module_metadata_with_dependencies).with("puppetlabs", "concat", nil).and_return({})
|
316
324
|
|
317
325
|
metadata = multi_forge.get_module_metadata_with_dependencies("puppetlabs", "apache", nil)
|
318
326
|
|
@@ -325,6 +333,38 @@ module PuppetLibrary::Forge
|
|
325
333
|
]
|
326
334
|
end
|
327
335
|
end
|
336
|
+
|
337
|
+
context "when a module's dependency is found in another forge" do
|
338
|
+
it "still includes the dependency" do
|
339
|
+
concat_metadata_1 = {
|
340
|
+
"puppetlabs/concat" => [ {
|
341
|
+
"version" => "1",
|
342
|
+
"dependencies" => [
|
343
|
+
[ "puppetlabs/stdlib", "1" ]
|
344
|
+
]
|
345
|
+
} ],
|
346
|
+
"puppetlabs/stdlib" => []
|
347
|
+
}
|
348
|
+
stdlib_meta_2 = {
|
349
|
+
"puppetlabs/stdlib" => [ {
|
350
|
+
"version" => "1",
|
351
|
+
"dependencies" => [ ]
|
352
|
+
} ]
|
353
|
+
}
|
354
|
+
expect(subforge_one).to receive(:get_module_metadata_with_dependencies).with("puppetlabs", "concat", nil).and_return(concat_metadata_1)
|
355
|
+
expect(subforge_two).to receive(:get_module_metadata_with_dependencies).with("puppetlabs", "concat", nil).and_return({})
|
356
|
+
expect(subforge_one).to receive(:get_module_metadata_with_dependencies).with("puppetlabs", "stdlib", nil).and_return({})
|
357
|
+
expect(subforge_two).to receive(:get_module_metadata_with_dependencies).with("puppetlabs", "stdlib", nil).and_return(stdlib_meta_2)
|
358
|
+
|
359
|
+
metadata = multi_forge.get_module_metadata_with_dependencies("puppetlabs", "concat", nil)
|
360
|
+
|
361
|
+
expect(metadata).to eq({
|
362
|
+
"puppetlabs/concat" => [ { "version"=>"1", "dependencies"=> [["puppetlabs/stdlib", "1"]] } ],
|
363
|
+
"puppetlabs/stdlib" => [ { "version"=>"1", "dependencies"=> [] } ]
|
364
|
+
})
|
365
|
+
end
|
366
|
+
end
|
367
|
+
|
328
368
|
end
|
329
369
|
end
|
330
370
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-library
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- drrb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|