librarian-puppet 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b67a1e452129a68f620fd106459e65a989214ad1
|
4
|
+
data.tar.gz: 37194dd860f12e353a03677ed2d5f0bc6c7e8504
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60d6ae144ba0ca780d18f204685d00294fce51c318df54e314003b9cc4ac6455193c95818b66c67ccc2b8ada0a1588b6114ab4333ba9d032b6b32ffadacd5202
|
7
|
+
data.tar.gz: 7de4706904ec8a96ad482f61c1fdcca5ca619549ad2d0555841c1f803de7cffcbc73c64e2a5cac420f9d8242fa34a89007057712699a1f70772bc284f85eab23
|
@@ -96,7 +96,7 @@ module Librarian
|
|
96
96
|
warn { "Replacing Puppet Forge API URL to use v3 #{module_repository} as required by your client version #{Librarian::Puppet.puppet_version}" }
|
97
97
|
end
|
98
98
|
|
99
|
-
m = module_repository.match(%r{^http(s)?://
|
99
|
+
m = module_repository.match(%r{^http(s)?://forge(api)?\.puppetlabs\.com})
|
100
100
|
if Forge.client_api_version() == 1 and m
|
101
101
|
ssl = m[1]
|
102
102
|
# Puppet 2.7 can't handle the 302 returned by the https url, so stick to http
|
@@ -37,41 +37,37 @@ module Librarian
|
|
37
37
|
def fetch_dependencies(name, version, extra)
|
38
38
|
dependencies = Set.new
|
39
39
|
|
40
|
-
dependencyList = if metadata?
|
41
|
-
JSON.parse(File.read(metadata))['dependencies']
|
42
|
-
elsif modulefile?
|
43
|
-
evaluate_modulefile(modulefile).dependencies.map do |dependency|
|
44
|
-
{
|
45
|
-
'name' => dependency.instance_variable_get(:@full_module_name),
|
46
|
-
'version_requirement' => dependency.instance_variable_get(:@version_requirement)
|
47
|
-
}
|
48
|
-
end
|
49
|
-
else []
|
50
|
-
end
|
51
|
-
|
52
|
-
dependencyList.each do |d|
|
53
|
-
gem_requirement = Requirement.new(d['version_requirement']).gem_requirement
|
54
|
-
dependencies << Dependency.new(d['name'], gem_requirement, forge_source)
|
55
|
-
end
|
56
|
-
|
57
40
|
if specfile?
|
58
41
|
spec = environment.dsl(Pathname(specfile))
|
59
42
|
dependencies.merge spec.dependencies
|
60
43
|
end
|
61
44
|
|
45
|
+
parsed_metadata['dependencies'].each do |d|
|
46
|
+
gem_requirement = Requirement.new(d['version_requirement']).gem_requirement
|
47
|
+
new_dependency = Dependency.new(d['name'], gem_requirement, forge_source)
|
48
|
+
# Avoid duplicated dependencies with different sources
|
49
|
+
unless dependencies.find { |spec_dependency| spec_dependency.name == new_dependency.name && spec_dependency.requirement == new_dependency.requirement }
|
50
|
+
dependencies << new_dependency
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
62
54
|
dependencies
|
63
55
|
end
|
64
56
|
|
65
57
|
def forge_source
|
66
|
-
Forge.from_lock_options(environment, :remote=>"
|
58
|
+
Forge.from_lock_options(environment, :remote => "https://forge.puppetlabs.com")
|
67
59
|
end
|
68
60
|
|
69
61
|
private
|
70
62
|
|
71
63
|
# Naming this method 'version' causes an exception to be raised.
|
72
64
|
def module_version
|
73
|
-
|
74
|
-
|
65
|
+
if parsed_metadata['version']
|
66
|
+
parsed_metadata['version']
|
67
|
+
else
|
68
|
+
warn { "Module #{to_s} does not have version, defaulting to 0.0.1" }
|
69
|
+
'0.0.1'
|
70
|
+
end
|
75
71
|
end
|
76
72
|
|
77
73
|
def require_puppet
|
@@ -106,6 +102,28 @@ module Librarian
|
|
106
102
|
metadata
|
107
103
|
end
|
108
104
|
|
105
|
+
def parsed_metadata
|
106
|
+
@metadata ||= if metadata?
|
107
|
+
JSON.parse(File.read(metadata))
|
108
|
+
elsif modulefile?
|
109
|
+
# translate Modulefile to metadata.json
|
110
|
+
evaluated = evaluate_modulefile(modulefile)
|
111
|
+
{
|
112
|
+
'version' => evaluated.version,
|
113
|
+
'dependencies' => evaluated.dependencies.map do |dependency|
|
114
|
+
{
|
115
|
+
'name' => dependency.instance_variable_get(:@full_module_name),
|
116
|
+
'version_requirement' => dependency.instance_variable_get(:@version_requirement)
|
117
|
+
}
|
118
|
+
end
|
119
|
+
}
|
120
|
+
else
|
121
|
+
warn { "Could not find metadata.json nor Modulefile at #{filesystem_path}" }
|
122
|
+
{}
|
123
|
+
end
|
124
|
+
@metadata
|
125
|
+
end
|
126
|
+
|
109
127
|
def modulefile
|
110
128
|
File.join(filesystem_path, 'Modulefile')
|
111
129
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: librarian-puppet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Sharpe
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-08-
|
12
|
+
date: 2014-08-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: librarian
|