chef-zero 1.4.0.alpha → 1.4

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,11 +1,8 @@
1
1
  require 'bundler'
2
- require 'bundler/gem_helper'
2
+ require 'bundler/gem_tasks'
3
3
 
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
4
+ require 'chef_zero/version'
8
5
 
9
6
  task :spec do
10
- sh 'ruby spec/run.rb'
7
+ require File.expand_path('spec/run')
11
8
  end
@@ -26,12 +26,11 @@ module ChefZero
26
26
  left.matches_doc?(doc)
27
27
  when ':'
28
28
  if left.respond_to?(:literal_string) && left.literal_string
29
- value = doc[left.literal_string]
30
- right.matches_values?([value])
29
+ values = doc[left.literal_string]
31
30
  else
32
31
  values = doc.matching_values { |key| left.matches_values?([key]) }
33
- right.matches_values?(values)
34
32
  end
33
+ right.matches_values?(values)
35
34
  end
36
35
  end
37
36
 
@@ -14,8 +14,7 @@ module ChefZero
14
14
  attr_reader :regexp
15
15
 
16
16
  def matches_doc?(doc)
17
- value = doc[DEFAULT_FIELD]
18
- return value ? matches_values?([value]) : false
17
+ matches_values?(doc[DEFAULT_FIELD])
19
18
  end
20
19
  def matches_values?(values)
21
20
  values.any? { |value| !@regexp.match(value).nil? }
@@ -9,31 +9,22 @@ module ChefZero
9
9
  end
10
10
 
11
11
  def [](key)
12
- values = matching_values { |match_key| match_key == key }
13
- values[0]
12
+ matching_values { |match_key| match_key == key }
14
13
  end
15
14
 
16
15
  def matching_values(&block)
17
- result = {}
16
+ result = []
18
17
  key_values(nil, @json) do |key, value|
19
18
  if block.call(key)
20
- if result.has_key?(key)
21
- result[key] << value.to_s
22
- else
23
- result[key] = value.to_s.clone
24
- end
19
+ result << value.to_s
25
20
  end
26
21
  end
27
22
  # Handle manufactured value(s)
28
23
  if block.call('X_CHEF_id_CHEF_X')
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
24
+ result << @id.to_s
34
25
  end
35
26
 
36
- result.values
27
+ result.uniq
37
28
  end
38
29
 
39
30
  private
@@ -1,3 +1,3 @@
1
1
  module ChefZero
2
- VERSION = '1.4.0.alpha'
2
+ VERSION = '1.4'
3
3
  end
@@ -5,21 +5,32 @@ require 'bundler/setup'
5
5
  require 'chef_zero/server'
6
6
  require 'rspec/core'
7
7
 
8
- require 'pedant'
9
- require 'pedant/opensource'
10
-
11
8
  server = ChefZero::Server.new(:port => 8889)
12
9
  server.start_background
13
10
 
14
- Pedant.config.suite = 'api'
15
- Pedant.config[:config_file] = 'spec/support/pedant.rb'
16
- Pedant.setup([
17
- '--skip-validation',
18
- '--skip-authentication',
19
- '--skip-authorization'
20
- ])
11
+ unless ENV['SKIP_PEDANT']
12
+ require 'pedant'
13
+ require 'pedant/opensource'
14
+
15
+ Pedant.config.suite = 'api'
16
+ Pedant.config[:config_file] = 'spec/support/pedant.rb'
17
+ Pedant.setup([
18
+ '--skip-validation',
19
+ '--skip-authentication',
20
+ '--skip-authorization'
21
+ ])
21
22
 
22
- result = RSpec::Core::Runner.run(Pedant.config.rspec_args)
23
+ result = RSpec::Core::Runner.run(Pedant.config.rspec_args)
24
+ else
25
+ require 'net/http'
26
+ response = Net::HTTP.new('127.0.0.1', 8889).get("/environments", { 'Accept' => 'application/json'}).body
27
+ if response =~ /_default/
28
+ result = 0
29
+ else
30
+ puts "GET /environments returned #{response}. Expected _default!"
31
+ result = 1
32
+ end
33
+ end
23
34
 
24
35
  server.stop
25
36
  exit(result)
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0.alpha
5
- prerelease: 6
4
+ version: '1.4'
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - John Keiser
@@ -16,17 +16,17 @@ dependencies:
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 1.6.3
21
+ version: '1.6'
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: 1.6.3
29
+ version: '1.6'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: mixlib-log
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -75,6 +75,22 @@ dependencies:
75
75
  - - <
76
76
  - !ruby/object:Gem::Version
77
77
  version: 0.7.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: json
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
78
94
  - !ruby/object:Gem::Dependency
79
95
  name: rake
80
96
  requirement: !ruby/object:Gem::Requirement
@@ -91,6 +107,22 @@ dependencies:
91
107
  - - ! '>='
92
108
  - !ruby/object:Gem::Version
93
109
  version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: rspec
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
94
126
  description: Self-contained, easy-setup, fast-start in-memory Chef server for testing
95
127
  and solo setup purposes
96
128
  email: jkeiser@opscode.com
@@ -174,9 +206,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
174
206
  required_rubygems_version: !ruby/object:Gem::Requirement
175
207
  none: false
176
208
  requirements:
177
- - - ! '>'
209
+ - - ! '>='
178
210
  - !ruby/object:Gem::Version
179
- version: 1.3.1
211
+ version: '0'
180
212
  requirements: []
181
213
  rubyforge_project:
182
214
  rubygems_version: 1.8.23