#!/usr/bin/env ruby require 'rack' require 'optparse' require 'web-puppet' options = {:daemonize => true, :port => 9295, :config => false} optparse = OptionParser.new do |opts| opts.banner = 'Usage: web-puppet [options] ...' opts.separator '' opts.separator 'Configuration options:' opts.on( '--no-daemonize', "Don't daemonize the web server process") do |username| options[:daemonize] = false end opts.on( '-p', '--port PORT', 'The port to run web-puppet on') do |port| options[:port] = port end opts.on( '-c', '--config FILE', 'The file to load with configuration options') do |file| options[:config] = file end opts.on_tail('-h', '--help', 'Display this screen' ) do puts opts exit end end begin optparse.parse! WebPuppet::App.run!(options) rescue OptionParser::InvalidArgument, OptionParser::InvalidOption, OptionParser::MissingArgument puts $!.to_s puts optparse exit rescue Errno::EACCES puts $!.to_s exit end