chef-zero 1.3 → 1.4.0.alpha

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,7 +1,10 @@
1
1
  require 'bundler'
2
- require 'bundler/gem_tasks'
2
+ require 'bundler/gem_helper'
3
3
 
4
- require 'chef_zero/version'
4
+ # Get build, install and release tasks for each gem flavor
5
+ %w(chef-zero chef-zero-x86-mingw32).each do |gem_name|
6
+ Bundler::GemHelper.install_tasks :name => gem_name
7
+ end
5
8
 
6
9
  task :spec do
7
10
  sh 'ruby spec/run.rb'
@@ -26,11 +26,12 @@ module ChefZero
26
26
  left.matches_doc?(doc)
27
27
  when ':'
28
28
  if left.respond_to?(:literal_string) && left.literal_string
29
- values = doc[left.literal_string]
29
+ value = doc[left.literal_string]
30
+ right.matches_values?([value])
30
31
  else
31
32
  values = doc.matching_values { |key| left.matches_values?([key]) }
33
+ right.matches_values?(values)
32
34
  end
33
- right.matches_values?(values)
34
35
  end
35
36
  end
36
37
 
@@ -14,7 +14,8 @@ module ChefZero
14
14
  attr_reader :regexp
15
15
 
16
16
  def matches_doc?(doc)
17
- matches_values?(doc[DEFAULT_FIELD])
17
+ value = doc[DEFAULT_FIELD]
18
+ return value ? matches_values?([value]) : false
18
19
  end
19
20
  def matches_values?(values)
20
21
  values.any? { |value| !@regexp.match(value).nil? }
@@ -9,22 +9,31 @@ module ChefZero
9
9
  end
10
10
 
11
11
  def [](key)
12
- matching_values { |match_key| match_key == key }
12
+ values = matching_values { |match_key| match_key == key }
13
+ values[0]
13
14
  end
14
15
 
15
16
  def matching_values(&block)
16
- result = []
17
+ result = {}
17
18
  key_values(nil, @json) do |key, value|
18
19
  if block.call(key)
19
- result << value.to_s
20
+ if result.has_key?(key)
21
+ result[key] << value.to_s
22
+ else
23
+ result[key] = value.to_s.clone
24
+ end
20
25
  end
21
26
  end
22
27
  # Handle manufactured value(s)
23
28
  if block.call('X_CHEF_id_CHEF_X')
24
- result << @id.to_s
29
+ if result.has_key?('X_CHEF_id_CHEF_X')
30
+ result['X_CHEF_id_CHEF_X'] << @id.to_s
31
+ else
32
+ result['X_CHEF_id_CHEF_X'] = @id.to_s.clone
33
+ end
25
34
  end
26
35
 
27
- result.uniq
36
+ result.values
28
37
  end
29
38
 
30
39
  private
@@ -1,3 +1,3 @@
1
1
  module ChefZero
2
- VERSION = '1.3'
2
+ VERSION = '1.4.0.alpha'
3
3
  end
metadata CHANGED
@@ -1,32 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.3'
5
- prerelease:
4
+ version: 1.4.0.alpha
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - John Keiser
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-06 00:00:00.000000000 Z
12
+ date: 2013-06-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: puma
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '2.0'
21
+ version: 1.6.3
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ~>
27
+ - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: '2.0'
29
+ version: 1.6.3
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: mixlib-log
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -158,8 +158,7 @@ files:
158
158
  - spec/run.rb
159
159
  - spec/support/pedant.rb
160
160
  - spec/support/stickywicket.pem
161
- - !binary |-
162
- YmluL2NoZWYtemVybw==
161
+ - bin/chef-zero
163
162
  homepage: http://www.opscode.com
164
163
  licenses: []
165
164
  post_install_message:
@@ -175,9 +174,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
175
174
  required_rubygems_version: !ruby/object:Gem::Requirement
176
175
  none: false
177
176
  requirements:
178
- - - ! '>='
177
+ - - ! '>'
179
178
  - !ruby/object:Gem::Version
180
- version: '0'
179
+ version: 1.3.1
181
180
  requirements: []
182
181
  rubyforge_project:
183
182
  rubygems_version: 1.8.23