diff options
author | John Keiser <john@johnkeiser.com> | 2013-06-10 07:42:03 -0700 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2013-06-10 07:42:03 -0700 |
commit | 1b9ce455ccb8ff95a9684fbe52b7c41843cc10a2 (patch) | |
tree | 4e5fbbd6e19e92e8edabfa8130f0deb4a55f1dda | |
parent | 196a4798d09b2b93866ebfe73b96bf2daba94f5f (diff) | |
parent | ec735cbc14c22400258b14a8b848929da7526fca (diff) | |
download | chef-zero-1b9ce455ccb8ff95a9684fbe52b7c41843cc10a2.tar.gz |
Merge pull request #19 from sethvargo/daemon
Support daemon mode
-rwxr-xr-x | bin/chef-zero | 16 | ||||
-rw-r--r-- | chef-zero.gemspec | 1 |
2 files changed, 15 insertions, 2 deletions
diff --git a/bin/chef-zero b/bin/chef-zero index b6b8a97..25c2364 100755 --- a/bin/chef-zero +++ b/bin/chef-zero @@ -24,6 +24,10 @@ OptionParser.new do |opts| options[:generate_real_keys] = value end + opts.on("-d", "--daemon", "Run as a daemon process") do |value| + options[:daemon] = value + end + opts.on("-l", "--log-level LEVEL", "Set the output log level") do |value| options[:log_level] = value end @@ -40,4 +44,14 @@ OptionParser.new do |opts| end.parse! server = ChefZero::Server.new(options) -server.start(:publish => true) + +if options[:daemon] + unless Process.respond_to?('daemon') + abort 'Process.deamon requires Ruby >= 1.9' + else + Process.daemon(true) + server.start(:publish => true) + end +else + server.start(:publish => true) +end diff --git a/chef-zero.gemspec b/chef-zero.gemspec index d751cc0..21f7058 100644 --- a/chef-zero.gemspec +++ b/chef-zero.gemspec @@ -25,4 +25,3 @@ Gem::Specification.new do |s| s.require_path = 'lib' s.files = %w(LICENSE README.md Rakefile) + Dir.glob('{lib,spec}/**/*') end - |