chef-zero 1.4 → 1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,6 +24,10 @@ OptionParser.new do |opts|
24
24
  options[:generate_real_keys] = value
25
25
  end
26
26
 
27
+ opts.on("-d", "--daemon", "Run as a daemon process") do |value|
28
+ options[:daemon] = value
29
+ end
30
+
27
31
  opts.on("-l", "--log-level LEVEL", "Set the output log level") do |value|
28
32
  options[:log_level] = value
29
33
  end
@@ -40,4 +44,14 @@ OptionParser.new do |opts|
40
44
  end.parse!
41
45
 
42
46
  server = ChefZero::Server.new(options)
43
- server.start(:publish => true)
47
+
48
+ if options[:daemon]
49
+ unless Process.respond_to?('daemon')
50
+ abort 'Process.deamon requires Ruby >= 1.9'
51
+ else
52
+ Process.daemon(true)
53
+ server.start(:publish => true)
54
+ end
55
+ else
56
+ server.start(:publish => true)
57
+ end
@@ -32,7 +32,12 @@ module ChefZero
32
32
  # TODO if recipes has 3 recipes in it, and the Ruby/JSON has only one, should
33
33
  # the resulting recipe list have 1, or 3-4 recipes in it?
34
34
  if has_child(directory, 'metadata.rb')
35
- metadata.instance_eval(read_file(directory, 'metadata.rb'))
35
+ begin
36
+ file = filename(directory, 'metadata.rb') || "(#{name}/metadata.rb)"
37
+ metadata.instance_eval(read_file(directory, 'metadata.rb'), file)
38
+ rescue
39
+ ChefZero::Log.error("Error loading cookbook #{name}: #{$!}\n#{$!.backtrace}")
40
+ end
36
41
  elsif has_child(directory, 'metadata.json')
37
42
  metadata.from_json(read_file(directory, 'metadata.json'))
38
43
  end
@@ -161,6 +166,14 @@ module ChefZero
161
166
  end
162
167
  end
163
168
 
169
+ def self.filename(directory, name)
170
+ if directory.respond_to?(:file_path)
171
+ File.join(directory.file_path, name)
172
+ else
173
+ nil
174
+ end
175
+ end
176
+
164
177
  def self.get_directory(directory, name)
165
178
  if directory.is_a?(Hash)
166
179
  directory[name].is_a?(Hash) ? directory[name] : nil
@@ -1,3 +1,3 @@
1
1
  module ChefZero
2
- VERSION = '1.4'
2
+ VERSION = '1.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.4'
4
+ version: '1.5'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-07 00:00:00.000000000 Z
12
+ date: 2013-06-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: puma
@@ -190,7 +190,8 @@ files:
190
190
  - spec/run.rb
191
191
  - spec/support/pedant.rb
192
192
  - spec/support/stickywicket.pem
193
- - bin/chef-zero
193
+ - !binary |-
194
+ YmluL2NoZWYtemVybw==
194
195
  homepage: http://www.opscode.com
195
196
  licenses: []
196
197
  post_install_message: