knife-inspect 0.9.2 → 0.10.0

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: 89c00f0b6f41512ce3384854fc731746e997aa8b
4
- data.tar.gz: 5f348ee2a2957d74e67a2d526695227046678f9f
3
+ metadata.gz: 5e648a13d315a3c1c9da0ec48d1560d7c4a4dabd
4
+ data.tar.gz: 9ef1e150143ffff406ba9d667b01791215d91bb8
5
5
  SHA512:
6
- metadata.gz: 9cf8232cabde6f90c15d65e78b5d8f826cc30767e68b589406dd4d2478334c5747101af5403bf57a56c2be1f2d2d3a86540a3839f7915b361343e54e89e02caa
7
- data.tar.gz: c18f0c00b0b9687c2309037c0f8cdb6ebf2c5e988106b8daf5fa3fa046563993bb90b538d9c5bca982989e393531a14256fe1b80b7f1f1177c882da614da7ef1
6
+ metadata.gz: 0db7de2d55926ada9f92bc65571f8fa31310389d88abee342bec923f8b4545324a5b4a8b80ca997cb2ff96993259ecc7a5e60dda06a45369d6d912edf8ec248d
7
+ data.tar.gz: 8c9a7d1fe7166a465b741e729c740da9bb4c761fcd2fb0dd681b2da2b7120ce9402c41984f41a4f4036226a8ee6a0d9b4b2fbf5bce77f9e69e2ba3653733fead
data/.travis.yml CHANGED
@@ -7,3 +7,5 @@ env:
7
7
  - CHEF_VERSION=11.14.2
8
8
  before_script:
9
9
  - chef-client --version
10
+ notifications:
11
+ email: false
data/HISTORY.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.10.0 ( 2014-10-13 )
2
+
3
+ * Feature: Support cookbooks that only have a `metadata.json` file but no
4
+ `metadata.rb` (Berkshelf does that) ([#5][#5])
5
+ * Feature: Use parallel lib to speed up REST API operations ([#27][#27])
6
+
1
7
  ## 0.9.2 ( 2014-08-11 )
2
8
 
3
9
  * Bug fix: Fixed regression in the regression fix for Chef 10 that broke
@@ -149,3 +155,5 @@ instead.
149
155
  [#22]: https://github.com/bmarini/knife-inspect/issues/22
150
156
  [#7]: https://github.com/bmarini/knife-inspect/issues/7
151
157
  [#25]: https://github.com/bmarini/knife-inspect/issues/25
158
+ [#5]: https://github.com/bmarini/knife-inspect/issues/5
159
+ [#27]: https://github.com/bmarini/knife-inspect/issues/27
data/README.md CHANGED
@@ -66,6 +66,7 @@ when everything is in sync or 1 if it's not.
66
66
  * Dan Buch ([@meatballhat](@https://github.com/meatballhat))
67
67
  * Kirt Fitzpatrick ([@kirtfitzpatrick](https://github.com/kirtfitzpatrick))
68
68
  * Ben Hughes ([@barn](https://github.com/barn))
69
+ * Grégoire Seux ([@kamaradclimber](https://github.com/kamaradclimber))
69
70
 
70
71
  ## Contributing
71
72
 
@@ -30,4 +30,5 @@ Gem::Specification.new do |s|
30
30
 
31
31
  s.add_runtime_dependency 'chef', chef_version
32
32
  s.add_runtime_dependency 'yajl-ruby', '~> 1.2'
33
+ s.add_runtime_dependency 'parallel', '~> 1.3'
33
34
  end
@@ -1,5 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  require 'pathname'
3
+ require 'parallel'
3
4
 
4
5
  module HealthInspector
5
6
  module Checklists
@@ -38,19 +39,16 @@ module HealthInspector
38
39
  (server_items + local_items).uniq.sort
39
40
  end
40
41
 
41
- def each_item
42
- all_item_names.each do |name|
43
- yield load_item(name)
44
- end
42
+ def load_validate(name)
43
+ item = load_item(name)
44
+ validate_item(item)
45
45
  end
46
46
 
47
47
  def run
48
48
  banner "Inspecting #{self.class.title}"
49
49
 
50
- results = []
51
-
52
- each_item do |item|
53
- results << validate_item(item)
50
+ results = Parallel.map(all_item_names) do |name|
51
+ load_validate(name)
54
52
  end
55
53
 
56
54
  !results.include?(false)
@@ -1,5 +1,6 @@
1
1
  require 'chef/version'
2
2
  require 'chef/cookbook_version'
3
+ require 'chef/cookbook_loader'
3
4
  require 'chef/checksum_cache' if Chef::Version.new(Chef::VERSION) < Chef::Version.new('11.0.0')
4
5
 
5
6
  module HealthInspector
@@ -104,18 +105,14 @@ module HealthInspector
104
105
  end
105
106
 
106
107
  def local_items
107
- @context.cookbook_path
108
- .map { |path| Dir["#{path}/*"] }
109
- .flatten
110
- .select { |path| File.exist?("#{path}/metadata.rb") }
111
- .reduce({}) do |hsh, path|
108
+ cl = Chef::CookbookLoader.new(@context.cookbook_path)
109
+ cl.load_cookbooks
112
110
 
113
- name = File.basename(path)
114
- version = (`grep '^version' #{path}/metadata.rb`).split.last[1...-1]
111
+ cl.inject({}) do |hash, (name, cookbook_version)|
112
+ hash[name] = Chef::Version.new(cookbook_version.version)
115
113
 
116
- hsh[name] = Chef::Version.new(version)
117
- hsh
118
- end
114
+ hash
115
+ end
119
116
  end
120
117
 
121
118
  def all_item_names
@@ -1,3 +1,3 @@
1
1
  module HealthInspector
2
- VERSION = '0.9.2'
2
+ VERSION = '0.10.0'
3
3
  end
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "cookbook_two",
3
+ "version": "0.0.1"
4
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-inspect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Karékinian
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-11 00:00:00.000000000 Z
12
+ date: 2014-10-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -101,6 +101,20 @@ dependencies:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '1.2'
104
+ - !ruby/object:Gem::Dependency
105
+ name: parallel
106
+ requirement: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.3'
111
+ type: :runtime
112
+ prerelease: false
113
+ version_requirements: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.3'
104
118
  description: knife-inspect is a knife plugin to compare the content of your Chef repository
105
119
  and Chef server
106
120
  email:
@@ -136,7 +150,7 @@ files:
136
150
  - lib/health_inspector/runner.rb
137
151
  - lib/health_inspector/version.rb
138
152
  - spec/chef-repo/cookbooks/cookbook_one/metadata.rb
139
- - spec/chef-repo/cookbooks/cookbook_two/metadata.rb
153
+ - spec/chef-repo/cookbooks/cookbook_two/metadata.json
140
154
  - spec/chef-repo/data_bags/data_bag_one/one.json
141
155
  - spec/chef-repo/data_bags/data_bag_two/two.json
142
156
  - spec/chef-repo/data_bags/subdir/data_bag_from_subdir/three.json
@@ -188,7 +202,7 @@ specification_version: 4
188
202
  summary: Inspect your chef repo as it is compared to what is on your chef server
189
203
  test_files:
190
204
  - spec/chef-repo/cookbooks/cookbook_one/metadata.rb
191
- - spec/chef-repo/cookbooks/cookbook_two/metadata.rb
205
+ - spec/chef-repo/cookbooks/cookbook_two/metadata.json
192
206
  - spec/chef-repo/data_bags/data_bag_one/one.json
193
207
  - spec/chef-repo/data_bags/data_bag_two/two.json
194
208
  - spec/chef-repo/data_bags/subdir/data_bag_from_subdir/three.json
@@ -214,4 +228,3 @@ test_files:
214
228
  - spec/health_inspector/checklists/role_spec.rb
215
229
  - spec/health_inspector/checklists/roles_spec.rb
216
230
  - spec/spec_helper.rb
217
- has_rdoc:
@@ -1,2 +0,0 @@
1
- name "cookbook_two"
2
- version "0.0.1"