batali 0.2.30 → 0.2.32

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: 034b14624fd03d050d9ae0e8d1142332b56882b1
4
- data.tar.gz: 083f314e9a0537ffc3c471f365693d1df8502f60
3
+ metadata.gz: bb8be253084c752f62ea9022af64502013512df6
4
+ data.tar.gz: 14c8943c92771c752d94825140352a39a544aec3
5
5
  SHA512:
6
- metadata.gz: d37d1bc1ec728b270524dee1af9eaa96963410e18f24258d83451479fba7cc2939908de50d7de364b417b87e14f82fef35985961ae728687c41cafa8c55ff475
7
- data.tar.gz: f0917117a5202699863a408ad1191ca2a5c4914576aa1808ba62e86df7d751c793ec9ce45d054d7ba7125512359ce01899216e939d31e1bfe990ab3c8d8c9803
6
+ metadata.gz: 8098dbc72989379d75e26ec694fad5be9c041dc659638c19cf4d85aa3bf68ebed4435c21d780cbaa0e0f207ca2525784f91da1e210fe86d2cd8ddf8896f30d53
7
+ data.tar.gz: 3f6de6fe1e4cb254bbc8322673f398297f5b37e433e60d04ca355a07375b1a902a3bc261785caac0d162890fcb8dc858202d7ada8e62eed440c4766e765fab12
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # v0.2.32
2
+ * [fix] Skip constraint merging when entry is non-site sourced
3
+ * [enhancement] Support dry run in infrastructure resolve
4
+ * [enhancement] Provide colorized diff on infrastructure manifest updates via resolve
5
+
1
6
  # v0.2.30
2
7
  * [fix] Run world pruner prior to manifest output
3
8
  * [enhancement] Provider UI context when pruning world
data/batali.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.require_path = 'lib'
12
12
  s.license = 'Apache 2.0'
13
13
  s.add_runtime_dependency 'attribute_struct', '~> 0.2.14'
14
- s.add_runtime_dependency 'grimoire', '~> 0.2.6'
14
+ s.add_runtime_dependency 'grimoire', '~> 0.2.8'
15
15
  s.add_runtime_dependency 'bogo', '~> 0.1.20'
16
16
  s.add_runtime_dependency 'bogo-cli', '~> 0.1.23'
17
17
  s.add_runtime_dependency 'bogo-config', '~> 0.1.10'
data/lib/batali/b_file.rb CHANGED
@@ -54,6 +54,24 @@ module Batali
54
54
  super
55
55
  end
56
56
 
57
+ ::Object.constants.each do |const_name|
58
+ next if const_name == :Config
59
+ const_set(const_name, ::Object.const_get(const_name))
60
+ end
61
+
62
+ def require(*args)
63
+ result = ::Kernel.require(*args)
64
+ instance_exec do
65
+ class << self
66
+ ::Object.constants.each do |const_name|
67
+ next if const_name == :Config
68
+ const_set(const_name, ::Object.const_get(const_name))
69
+ end
70
+ end
71
+ end
72
+ result
73
+ end
74
+
57
75
  end
58
76
 
59
77
  # Create a new file
@@ -157,6 +175,10 @@ module Batali
157
175
  c.name == ckbk_name
158
176
  end
159
177
  if(ckbk)
178
+ unless(ckbk.constraint)
179
+ debug "Skipping constraint merging due to lack of original constraints: #{ckbk.inspect}"
180
+ next
181
+ end
160
182
  new_constraints = ckbk.constraint.dup
161
183
  new_constraints += constraints
162
184
  requirement = UnitRequirement.new(*new_constraints)
@@ -126,19 +126,59 @@ module Batali
126
126
  solv.prune_world!
127
127
  nil
128
128
  end
129
- run_action 'Writing infrastructure manifest file' do
130
- File.open(manifest.path, 'w') do |file|
131
- manifest = Manifest.new(
132
- :cookbook => solv.world.units.values.flatten,
133
- :infrastructure => true
134
- )
135
- file.write MultiJson.dump(manifest, :pretty => true)
136
- nil
129
+ dry_run('manifest file write') do
130
+ run_action 'Writing infrastructure manifest file' do
131
+ File.open(manifest.path, 'w') do |file|
132
+ manifest = Manifest.new(
133
+ :cookbook => solv.world.units.values.flatten,
134
+ :infrastructure => true
135
+ )
136
+ file.write MultiJson.dump(manifest, :pretty => true)
137
+ nil
138
+ end
137
139
  end
138
140
  end
139
141
  ui.info 'Infrastructure manifest solution:'
140
- solv.world.units.sort_by(&:first).each do |name, units|
141
- ui.puts "#{name} <#{units.map(&:version).sort.map(&:to_s).join(', ')}>"
142
+
143
+ solution_units = solv.world.units
144
+ manifest_units = Smash.new.tap do |mu|
145
+ manifest.cookbook.each do |unit|
146
+ mu[unit.name] ||= []
147
+ mu[unit.name] << unit
148
+ end
149
+ end
150
+ (solution_units.keys + manifest_units.keys).compact.uniq.sort.each do |unit_name|
151
+ if(manifest_units[unit_name])
152
+ if(solution_units[unit_name])
153
+ removed = manifest_units[unit_name].find_all do |m_unit|
154
+ solution_units[unit_name].none? do |s_unit|
155
+ m_unit.same?(s_unit)
156
+ end
157
+ end.map{|u| [u.version, :red] }
158
+ added = solution_units[unit_name].find_all do |s_unit|
159
+ manifest_units[unit_name].none? do |m_unit|
160
+ s_unit.same?(m_unit)
161
+ end
162
+ end.map{|u| [u.version, :green]}
163
+ persisted = solution_units[unit_name].find_all do |s_unit|
164
+ manifest_units[unit_name].any? do |m_unit|
165
+ s_unit.same?(m_unit)
166
+ end
167
+ end.map{|u| [u.version, nil]}
168
+ unit_versions = (removed + added + persisted).sort_by(&:first).map do |uv|
169
+ uv.last ? ui.color(uv.first.to_s, uv.last) : uv.first.to_s
170
+ end
171
+ unless(added.empty? && removed.empty?)
172
+ ui.puts "#{ui.color(unit_name, :yellow)} #{ui.color('<', :yellow)}#{unit_versions.join(ui.color(', ', :yellow))}#{ui.color('>', :yellow)}"
173
+ else
174
+ ui.puts "#{unit_name} <#{unit_versions.join(', ')}>"
175
+ end
176
+ else
177
+ ui.puts ui.color("#{unit_name} <#{manifest_units[unit_name].map(&:version).sort.map(&:to_s).join(', ')}>", :red)
178
+ end
179
+ else
180
+ ui.puts ui.color("#{unit_name} <#{solution_units[unit_name].map(&:version).sort.map(&:to_s).join(', ')}>", :green)
181
+ end
142
182
  end
143
183
  end
144
184
 
@@ -1,4 +1,4 @@
1
1
  module Batali
2
2
  # Current version
3
- VERSION = Gem::Version.new('0.2.30')
3
+ VERSION = Gem::Version.new('0.2.32')
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: batali
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.30
4
+ version: 0.2.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.2.6
33
+ version: 0.2.8
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.2.6
40
+ version: 0.2.8
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bogo
43
43
  requirement: !ruby/object:Gem::Requirement