batali-wedge 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/batali-wedge.gemspec +1 -0
- data/lib/batali-wedge/sync.rb +14 -9
- data/lib/batali-wedge/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef69a6b06a756322f8df232ffc6a9c81333e1b09
|
4
|
+
data.tar.gz: 8303ac1dd941339ae34de7211a73e81cf4ba1f92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6398b9b1a45bf3f9973dc210d22a66452fafc89157b9363e7d3aed6d187bdd395da49f4e2e96baa6d1c813af02c1a464248082e7b5fa63e87858d66f45e179b3
|
7
|
+
data.tar.gz: f096fde169e4dec00a989c1ee39f9d6e1fa970472117de11d64b4edb57de8bc6cbba54c7aeb20629738afac7f74afb2bed9c3db7ab814f55c52a9fac3d35ad38
|
data/batali-wedge.gemspec
CHANGED
@@ -11,5 +11,6 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.require_path = 'lib'
|
12
12
|
s.license = 'Apache 2.0'
|
13
13
|
s.add_runtime_dependency 'batali'
|
14
|
+
s.add_runtime_dependency 'chef', '~> 12.2.0'
|
14
15
|
s.files = Dir['{lib}/**/**/*'] + %w(batali-wedge.gemspec README.md CHANGELOG.md LICENSE)
|
15
16
|
end
|
data/lib/batali-wedge/sync.rb
CHANGED
@@ -36,15 +36,18 @@ module BataliWedge
|
|
36
36
|
#
|
37
37
|
# @return [Hash]
|
38
38
|
def batali_cookbook_hash
|
39
|
-
Chef::Log.
|
39
|
+
Chef::Log.warn 'Resolving cookbooks via Batali!'
|
40
40
|
system = batali_build_system
|
41
41
|
constraints = Smash[
|
42
42
|
api_service.get_rest("environments/#{node.chef_environment}").cookbook_versions.to_a
|
43
43
|
]
|
44
44
|
@expanded_run_list_with_versions.each do |item|
|
45
45
|
c_name, c_version = item.split('@')
|
46
|
+
c_name = c_name.split('::').first
|
46
47
|
if(c_version)
|
47
48
|
constraints[c_name] = c_version
|
49
|
+
elsif(constraints[c_name].nil?)
|
50
|
+
constraints[c_name] = '> 0'
|
48
51
|
end
|
49
52
|
end
|
50
53
|
requirements = Grimoire::RequirementList.new(
|
@@ -57,8 +60,8 @@ module BataliWedge
|
|
57
60
|
)
|
58
61
|
results = solver.generate!
|
59
62
|
solution = results.pop
|
60
|
-
solution_output = solution.sort_by(&:name).map{|u| "#{u.name}<#{u.version}>"}.join(', ')
|
61
|
-
Chef::Log.
|
63
|
+
solution_output = solution.units.sort_by(&:name).map{|u| "#{u.name}<#{u.version}>"}.join(', ')
|
64
|
+
Chef::Log.warn "Batali cookbook resolution: #{solution_output}"
|
62
65
|
Hash[
|
63
66
|
solution.units.map do |unit|
|
64
67
|
[unit.name, api_service.get_rest("cookbooks/#{unit.name}/#{unit.version}")]
|
@@ -75,14 +78,16 @@ module BataliWedge
|
|
75
78
|
meta['versions'].map do |info|
|
76
79
|
"#{c_name}/#{info['version']}"
|
77
80
|
end
|
78
|
-
end.map do |ckbk|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
81
|
+
end.flatten.map do |ckbk|
|
82
|
+
Batali::Unit.new(
|
83
|
+
Smash.new(
|
84
|
+
:name => ckbk.split('/').first,
|
85
|
+
:version => ckbk.split('/').last,
|
86
|
+
:dependencies => api_service.get_rest("cookbooks/#{ckbk}").metadata.dependencies.to_a
|
87
|
+
)
|
83
88
|
)
|
84
89
|
end
|
85
|
-
system.
|
90
|
+
system.add_unit(*units)
|
86
91
|
system
|
87
92
|
end
|
88
93
|
|
data/lib/batali-wedge/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: batali-wedge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: chef
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 12.2.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 12.2.0
|
27
41
|
description: Wedge magic into Chef
|
28
42
|
email: code@chrisroberts.org
|
29
43
|
executables: []
|