batali-wedge 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46ed9b345a1867c08fdc12e4cdd669c8d34bfbfa
4
- data.tar.gz: db30d18b5ec9ca2baad55d4a19846165ed2cc535
3
+ metadata.gz: ef69a6b06a756322f8df232ffc6a9c81333e1b09
4
+ data.tar.gz: 8303ac1dd941339ae34de7211a73e81cf4ba1f92
5
5
  SHA512:
6
- metadata.gz: c836e221969b0014ecf1df910dc6517cbfca54598125ed9797c931113060a29bed3dfa45387153f46ad899ffd45071bca8d76900785a515a7629cae6fc0fe7ba
7
- data.tar.gz: 4088261f00526d61d37760e2eb9063f3e45c1beb99121270630cb60662a6071df7e595800de646246489a6a1099c18d14f4b3d8233e7d78b818017642c62842e
6
+ metadata.gz: 6398b9b1a45bf3f9973dc210d22a66452fafc89157b9363e7d3aed6d187bdd395da49f4e2e96baa6d1c813af02c1a464248082e7b5fa63e87858d66f45e179b3
7
+ data.tar.gz: f096fde169e4dec00a989c1ee39f9d6e1fa970472117de11d64b4edb57de8bc6cbba54c7aeb20629738afac7f74afb2bed9c3db7ab814f55c52a9fac3d35ad38
@@ -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
@@ -36,15 +36,18 @@ module BataliWedge
36
36
  #
37
37
  # @return [Hash]
38
38
  def batali_cookbook_hash
39
- Chef::Log.info 'Resolving cookbooks via Batali!'
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.info "Batali cookbook resolution: #{solution_output}"
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
- Smash.new(
80
- :name => ckbk.split('/').first,
81
- :version => ckbk.split('/').last,
82
- :dependencies => api_service.get_rest("cookbooks/#{ckbk}").metadata.dependencies.to_a
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.add_units(units)
90
+ system.add_unit(*units)
86
91
  system
87
92
  end
88
93
 
@@ -1,3 +1,3 @@
1
1
  module BataliWedge
2
- VERSION = Gem::Version.new('0.0.1')
2
+ VERSION = Gem::Version.new('0.0.2')
3
3
  end
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.1
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: []