librarian-puppet 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/librarian/puppet/action/resolve.rb +5 -0
- data/lib/librarian/puppet/dependency.rb +9 -1
- data/lib/librarian/puppet/dsl.rb +31 -0
- data/lib/librarian/puppet/lockfile.rb +40 -1
- data/lib/librarian/puppet/resolver.rb +21 -0
- data/lib/librarian/puppet/source/forge.rb +1 -1
- data/lib/librarian/puppet/source/forge/repo.rb +1 -1
- data/lib/librarian/puppet/source/forge/repo_v1.rb +1 -1
- data/lib/librarian/puppet/source/githubtarball/repo.rb +1 -1
- data/lib/librarian/puppet/source/local.rb +1 -1
- data/lib/librarian/puppet/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c107d21c979b589b05492945c89c16c14c4dc2655b63e347ee8048d47e66a259
|
4
|
+
data.tar.gz: 60f587d482976725bd421e2617dad882a77e8d1d6fbb7c435be355b6e8d4a7d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1826a56a163a23e8b050662cea03f531158fdb682301017d5aef9aa9e0f89fc3f91d4d139dca74f35b959d9cb06663f1a0cc5ae7891857addc64255adf17073
|
7
|
+
data.tar.gz: b3dd541186ac0c1fa7de5cb175eaa146d1a8d391a2697bab3b0f09cbdb1cdb71157c16d13dc6052f149782ff7405877dd03f834ecffebdaebdd14dd3d70956e1
|
@@ -5,13 +5,21 @@ module Librarian
|
|
5
5
|
|
6
6
|
include Librarian::Puppet::Util
|
7
7
|
|
8
|
-
|
8
|
+
attr_accessor :parent
|
9
|
+
private :parent=
|
10
|
+
|
11
|
+
def initialize(name, requirement, source, parent = nil)
|
9
12
|
# Issue #235 fail if forge source is not defined
|
10
13
|
raise Error, "forge entry is not defined in Puppetfile" if source.instance_of?(Array) && source.empty?
|
11
14
|
|
15
|
+
self.parent = parent
|
12
16
|
super(normalize_name(name), requirement, source)
|
13
17
|
end
|
14
18
|
|
19
|
+
def to_s
|
20
|
+
"#{name} (#{requirement}) <#{source}> (from #{parent.nil? ? '<nil>' : parent})"
|
21
|
+
end
|
22
|
+
|
15
23
|
end
|
16
24
|
|
17
25
|
end
|
data/lib/librarian/puppet/dsl.rb
CHANGED
@@ -37,6 +37,37 @@ module Librarian
|
|
37
37
|
Receiver.new(target)
|
38
38
|
end
|
39
39
|
|
40
|
+
def run(specfile = nil, sources = [])
|
41
|
+
specfile, sources = nil, specfile if specfile.kind_of?(Array) && sources.empty?
|
42
|
+
|
43
|
+
Target.new(self).tap do |target|
|
44
|
+
target.precache_sources(sources)
|
45
|
+
debug_named_source_cache("Pre-Cached Sources", target)
|
46
|
+
|
47
|
+
specfile ||= Proc.new if block_given?
|
48
|
+
|
49
|
+
if specfile.kind_of?(Pathname) and !File.exists?(specfile)
|
50
|
+
debug { "Specfile #{specfile} not found, using defaults" } unless specfile.nil?
|
51
|
+
receiver(target).run(specfile, &default_specfile)
|
52
|
+
else
|
53
|
+
receiver(target).run(specfile)
|
54
|
+
end
|
55
|
+
|
56
|
+
post_process_target(target)
|
57
|
+
|
58
|
+
debug_named_source_cache("Post-Cached Sources", target)
|
59
|
+
end.to_spec
|
60
|
+
end
|
61
|
+
|
62
|
+
class Target < Librarian::Dsl::Target
|
63
|
+
def dependency(name, *args)
|
64
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
65
|
+
source = source_from_options(options) || @source
|
66
|
+
dep = dependency_type.new(name, args, source, 'Puppetfile')
|
67
|
+
@dependencies << dep
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
40
71
|
class Receiver < Librarian::Dsl::Receiver
|
41
72
|
attr_reader :specfile, :working_path
|
42
73
|
|
@@ -25,7 +25,46 @@ module Librarian
|
|
25
25
|
alias_method :old_lookup, :[]
|
26
26
|
define_method(:[]) { |k| self.old_lookup(normalize_name(k)) }
|
27
27
|
end
|
28
|
-
|
28
|
+
dependencies = []
|
29
|
+
while lines.first =~ /^ {2}([\w\-\/]+)(?: \((.*)\))?$/
|
30
|
+
lines.shift
|
31
|
+
name, requirement = $1, $2.split(/,\s*/)
|
32
|
+
dependencies << environment.dsl_class.dependency_type.new(name, requirement, manifests_index[name].source, 'lockfile')
|
33
|
+
end
|
34
|
+
dependencies
|
35
|
+
end
|
36
|
+
|
37
|
+
def compile_placeholder_manifests(sources_ast)
|
38
|
+
manifests = {}
|
39
|
+
sources_ast.each do |source_ast|
|
40
|
+
source_type = source_ast[:type]
|
41
|
+
source = source_type.from_lock_options(environment, source_ast[:options])
|
42
|
+
source_ast[:manifests].each do |manifest_name, manifest_ast|
|
43
|
+
manifests[manifest_name] = ManifestPlaceholder.new(
|
44
|
+
source,
|
45
|
+
manifest_name,
|
46
|
+
manifest_ast[:version],
|
47
|
+
manifest_ast[:dependencies].map do |k, v|
|
48
|
+
environment.dsl_class.dependency_type.new(k, v, nil, manifest_name)
|
49
|
+
end
|
50
|
+
)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
manifests
|
54
|
+
end
|
55
|
+
|
56
|
+
def compile(sources_ast)
|
57
|
+
manifests = compile_placeholder_manifests(sources_ast)
|
58
|
+
manifests = manifests.map do |name, manifest|
|
59
|
+
dependencies = manifest.dependencies.map do |d|
|
60
|
+
environment.dsl_class.dependency_type.new(d.name, d.requirement, manifests[d.name].source, name)
|
61
|
+
end
|
62
|
+
real = Manifest.new(manifest.source, manifest.name)
|
63
|
+
real.version = manifest.version
|
64
|
+
real.dependencies = manifest.dependencies
|
65
|
+
real
|
66
|
+
end
|
67
|
+
ManifestSet.sort(manifests)
|
29
68
|
end
|
30
69
|
|
31
70
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'librarian/resolver'
|
2
|
+
|
3
|
+
module Librarian
|
4
|
+
module Puppet
|
5
|
+
class Resolver < Librarian::Resolver
|
6
|
+
|
7
|
+
class Implementation < Librarian::Resolver::Implementation
|
8
|
+
def sourced_dependency_for(dependency)
|
9
|
+
return dependency if dependency.source
|
10
|
+
|
11
|
+
source = dependency_source_map[dependency.name] || default_source
|
12
|
+
dependency.class.new(dependency.name, dependency.requirement, source, dependency.parent)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def implementation(spec)
|
17
|
+
Implementation.new(self, spec, :cyclic => cyclic)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -144,7 +144,7 @@ module Librarian
|
|
144
144
|
def fetch_dependencies(name, version, version_uri)
|
145
145
|
repo(name).dependencies(version).map do |k, v|
|
146
146
|
v = Librarian::Dependency::Requirement.new(v).to_gem_requirement
|
147
|
-
Dependency.new(k, v, nil)
|
147
|
+
Dependency.new(k, v, nil, name)
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
@@ -74,7 +74,7 @@ module Librarian
|
|
74
74
|
debug { "Querying Forge API for module #{name}#{" and version #{version}" unless version.nil?}: #{url}" }
|
75
75
|
|
76
76
|
begin
|
77
|
-
data = open(url) {|f| f.read}
|
77
|
+
data = URI.open(url) {|f| f.read}
|
78
78
|
JSON.parse(data)
|
79
79
|
rescue OpenURI::HTTPError => e
|
80
80
|
case e.io.status[0].to_i
|
@@ -77,7 +77,7 @@ module Librarian
|
|
77
77
|
File.open(vendored_path(vendored_name(name), version).to_s, 'wb') do |f|
|
78
78
|
begin
|
79
79
|
debug { "Downloading <#{url}> to <#{f.path}>" }
|
80
|
-
open(url,
|
80
|
+
URI.open(url,
|
81
81
|
"User-Agent" => "librarian-puppet v#{Librarian::Puppet::VERSION}") do |res|
|
82
82
|
while buffer = res.read(8192)
|
83
83
|
f.write(buffer)
|
@@ -44,7 +44,7 @@ module Librarian
|
|
44
44
|
|
45
45
|
parsed_metadata['dependencies'].each do |d|
|
46
46
|
gem_requirement = Librarian::Dependency::Requirement.new(d['version_requirement']).to_gem_requirement
|
47
|
-
new_dependency = Dependency.new(d['name'], gem_requirement, forge_source)
|
47
|
+
new_dependency = Dependency.new(d['name'], gem_requirement, forge_source, name)
|
48
48
|
dependencies << new_dependency
|
49
49
|
end
|
50
50
|
|
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: 3.0.
|
4
|
+
version: 3.0.1
|
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:
|
12
|
+
date: 2021-04-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: librarianp
|
@@ -115,14 +115,14 @@ dependencies:
|
|
115
115
|
requirements:
|
116
116
|
- - "~>"
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: 5.
|
118
|
+
version: 5.3.0
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
123
|
- - "~>"
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: 5.
|
125
|
+
version: 5.3.0
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: minitest
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -191,6 +191,7 @@ files:
|
|
191
191
|
- lib/librarian/puppet/environment.rb
|
192
192
|
- lib/librarian/puppet/extension.rb
|
193
193
|
- lib/librarian/puppet/lockfile.rb
|
194
|
+
- lib/librarian/puppet/resolver.rb
|
194
195
|
- lib/librarian/puppet/source.rb
|
195
196
|
- lib/librarian/puppet/source/forge.rb
|
196
197
|
- lib/librarian/puppet/source/forge/repo.rb
|
@@ -224,8 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
225
|
- !ruby/object:Gem::Version
|
225
226
|
version: '0'
|
226
227
|
requirements: []
|
227
|
-
|
228
|
-
rubygems_version: 2.7.4
|
228
|
+
rubygems_version: 3.0.8
|
229
229
|
signing_key:
|
230
230
|
specification_version: 4
|
231
231
|
summary: Bundler for your Puppet modules
|