summaryrefslogtreecommitdiff
path: root/bin/chef-zero
blob: 29de40979f459cb88856b1e14e0929a46db501ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env ruby

require 'rubygems'
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))

require 'chef_zero/version'
require 'chef_zero/server'
require 'optparse'

options = {
  :host => '127.0.0.1',
  :port => 8889,
  :generate_real_keys => false
}
OptionParser.new do |opts|
  opts.banner = "Usage: chef-zero [ARGS]"

  opts.on("-H", "--host HOST", "Host to bind to (default: 127.0.0.1)") do |value|
    options[:host] = value
  end
  opts.on("-p", "--port PORT", Integer, "Port to listen on") do |value|
    options[:port] = value
  end
  opts.on("--[no-]generate-keys", "Whether to generate actual keys or fake it (faster).  Default: false.") do |value|
    options[:generate_real_keys] = value
  end

  opts.on_tail("-h", "--help", "Show this message") do
    puts opts
    exit
  end

  opts.on_tail("--version", "Show version") do
    puts ChefZero::VERSION
    exit
  end
end.parse!

server = ChefZero::Server.new(options)
server.start