summaryrefslogtreecommitdiff
path: root/bin/chef-zero
blob: 85f0849691f02c4d139ee68138f77a63ffd57e6d (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
41
42
43
44
45
46
#!/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("-d", "--debug", "Show requests and debugging output") do |value|
    options[:debug] = true
  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