knife-inspect 0.14.1 → 0.15.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: df44c7117866177d6763bb03b81eb95353af13fe
4
- data.tar.gz: 540a14e765e9d18acb68050c1914c283b0a7fe8e
3
+ metadata.gz: f6bfd104cb7e5ac63c15140fb15470a9e5954a2a
4
+ data.tar.gz: 709c71f1dea8ed399459eb97f0304f32f527e5b1
5
5
  SHA512:
6
- metadata.gz: 4d0f3b29557479ede0bed9e51bf3a800371ac235d1138a119743e34cd1c5602159a896d864998c3c2ef87f9be5fb232d2e9ded6dfa86ddea16001b94997da3d9
7
- data.tar.gz: ba837b29eaf4bd6385d582a7e835939a4d89e413a41392d09dc085614abd4a7bff108f398ee6f20a1ff3a31425de80a53892c197d6c052f23c320b926844835d
6
+ metadata.gz: 1f051f4156e4458700f70bb3b1f761da1c25f254138826dd0276926a4456011a89d839bb72e15f442900a243536ac0dbc4151e9c94387587b9c03da46ad96482
7
+ data.tar.gz: 9ff4c5c8f1f6018963c40289c8409b2a89b5bc7c1c5127c28ee9fb582b9c1a4f428921982418d3b372eb7077ae552492245dad7e654a1c484f8e34643c6a43c5
@@ -1,11 +1,13 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
- - 2.1
5
- - 2.2
4
+ - 2.1.10
5
+ - 2.2.5
6
+ - 2.3.1
6
7
  env:
7
8
  - CHEF_VERSION=12.6.0
8
9
  - CHEF_VERSION=12.7.2
10
+ - CHEF_VERSION=11.18.12
9
11
  notifications:
10
12
  email: false
11
13
  sudo: false
data/HISTORY.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.15.0 ( 2016-08-03 )
2
+
3
+ * New (old) feature: Chef 11 is supported again! ([#46][#46]). Thanks @kdaniels!
4
+ * Updated development dependencies and set the version of rack to < 2
5
+ * Switch to ffi-yajl like Chef
6
+
7
+
1
8
  ## 0.14.1 ( 2016-07-22 )
2
9
 
3
10
  * Bug fix: explicitly call the `HealthInspector` module with a root prefix
data/README.md CHANGED
@@ -68,9 +68,7 @@ when everything is in sync or 1 if it's not.
68
68
 
69
69
  ## Compatibility
70
70
 
71
- This gem is tested with Ruby 2.1 and 2.2 and as of version 0.14.0 is only
72
- compatible with Chef 12. For now use version 0.13.0 if you are still using Chef
73
- 11.
71
+ This gem is tested with Ruby 2.1 and 2.2 and has been tested with Chef 12 and Chef 11.
74
72
 
75
73
  ## Contributors
76
74
 
@@ -6,7 +6,7 @@ require "health_inspector/version"
6
6
  chef_version = if ENV.key?('CHEF_VERSION')
7
7
  "= #{ENV['CHEF_VERSION']}"
8
8
  else
9
- '>= 12.0.0'
9
+ '>= 11.0.0'
10
10
  end
11
11
 
12
12
  Gem::Specification.new do |s|
@@ -23,13 +23,13 @@ Gem::Specification.new do |s|
23
23
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
24
24
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
25
25
 
26
- s.add_development_dependency 'rake', '~> 10.1'
27
- s.add_development_dependency 'rspec', '~> 3.4.0'
28
- s.add_development_dependency 'simplecov', '~> 0.11'
29
- s.add_development_dependency 'coveralls', '~> 0.7'
26
+ s.add_development_dependency 'rake', '~> 11.2'
27
+ s.add_development_dependency 'rspec', '~> 3.5.0'
28
+ s.add_development_dependency 'simplecov', '~> 0.12'
29
+ s.add_development_dependency 'coveralls', '~> 0.8'
30
30
 
31
31
  s.add_runtime_dependency 'chef', chef_version
32
- s.add_runtime_dependency 'yajl-ruby', '~> 1.2'
32
+ s.add_runtime_dependency 'rack', '< 2'
33
33
  s.add_runtime_dependency 'parallel', '~> 1.3'
34
34
  s.add_runtime_dependency 'inflecto', '~> 0.0.2'
35
35
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  require 'pathname'
3
- require 'yajl'
3
+ require 'ffi_yajl'
4
4
  require 'parallel'
5
5
  require 'inflecto'
6
6
 
@@ -141,9 +141,11 @@ module HealthInspector
141
141
  instance = chef_class.new
142
142
  instance.from_file(ruby_pathname.first.to_s)
143
143
  elsif !json_pathname.empty?
144
- instance = chef_class.from_hash(Yajl::Parser.parse(json_pathname.first.read))
144
+ parsed_json = FFI_Yajl::Parser.parse(json_pathname.first.read)
145
+ instance = load_instance_from(parsed_json, chef_class)
145
146
  elsif !js_pathname.empty?
146
- instance = chef_class.from_hash(Yajl::Parser.parse(js_pathname.first.read))
147
+ parsed_json = FFI_Yajl::Parser.parse(js_pathname.first.read)
148
+ instance = load_instance_from(parsed_json, chef_class)
147
149
  end
148
150
 
149
151
  instance ? instance.to_hash : nil
@@ -154,6 +156,18 @@ module HealthInspector
154
156
  def indent(string, depth)
155
157
  (' ' * 2 * depth) + string
156
158
  end
159
+
160
+ private
161
+
162
+ # This supports both Chef 11 and 12+ (assuming the public API still has
163
+ # #from_hash
164
+ def load_instance_from(parsed_json, chef_class)
165
+ if Gem::Version.new(Chef::VERSION) < Gem::Version.new('12.0.0')
166
+ chef_class.json_create(parsed_json)
167
+ else
168
+ chef_class.from_hash(parsed_json)
169
+ end
170
+ end
157
171
  end
158
172
  end
159
173
  end
@@ -1,5 +1,5 @@
1
1
  require 'chef/data_bag'
2
- require 'yajl'
2
+ require 'ffi_yajl'
3
3
 
4
4
  module HealthInspector
5
5
  module Checklists
@@ -48,8 +48,8 @@ module HealthInspector
48
48
  local_data_bag_item = Dir["#{@context.repo_path}/data_bags/**/#{name}.json"].first
49
49
  return nil if local_data_bag_item.nil?
50
50
 
51
- Yajl::Parser.parse(File.read(local_data_bag_item))
52
- rescue Yajl::ParseError
51
+ FFI_Yajl::Parser.parse(File.read(local_data_bag_item))
52
+ rescue FFI_Yajl::ParseError
53
53
  nil
54
54
  end
55
55
  end
@@ -1,3 +1,3 @@
1
1
  module HealthInspector
2
- VERSION = '0.14.1'
2
+ VERSION = '0.15.0'
3
3
  end
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.14.1
4
+ version: 0.15.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: 2016-07-22 00:00:00.000000000 Z
12
+ date: 2016-08-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -17,84 +17,84 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '10.1'
20
+ version: '11.2'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '10.1'
27
+ version: '11.2'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rspec
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 3.4.0
34
+ version: 3.5.0
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 3.4.0
41
+ version: 3.5.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: simplecov
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '0.11'
48
+ version: '0.12'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '0.11'
55
+ version: '0.12'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: coveralls
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '0.7'
62
+ version: '0.8'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '0.7'
69
+ version: '0.8'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: chef
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: 12.0.0
76
+ version: 11.0.0
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
- version: 12.0.0
83
+ version: 11.0.0
84
84
  - !ruby/object:Gem::Dependency
85
- name: yajl-ruby
85
+ name: rack
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - "~>"
88
+ - - "<"
89
89
  - !ruby/object:Gem::Version
90
- version: '1.2'
90
+ version: '2'
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - "~>"
95
+ - - "<"
96
96
  - !ruby/object:Gem::Version
97
- version: '1.2'
97
+ version: '2'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: parallel
100
100
  requirement: !ruby/object:Gem::Requirement