Sha256: c319e4873b283fa538c5f83eaabbbe3f29418fc9f95ef61f8ff2b669ebe924ad

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

#!/usr/bin/env ruby

$:.push File.join(File.dirname(__FILE__), '..', 'lib')

require 'optparse'
require 'environmate/app'

options = {
  verbosity:  nil,
  foreground: false,
  trace:      false,
}

parser = OptionParser.new do|opts|
	opts.banner = "Usage: environmate [options]"

	opts.on('-c', '--config CONFIGFILE.YML', 'Location of the configuration file') do |config_file|
		options[:config_file] = config_file
	end

  opts.on('-e', '--rack_env RACK_ENV', 'Rack environment') do |rack_env|
		ENV['RACK_ENV'] = rack_env
	end

	opts.on('-v', '--verbosity VERBOSITY', 'Log Verbosity: ERROR, WARN, INFO, DEBUG') do |verbosity|
		options[:verbosity] = verbosity
	end

	opts.on('-f', '--foreground', 'Log to console instead of logfile and don\'t daemonize') do
		options[:foreground] = true
	end

  opts.on('-t', '--trace', 'Print backtrace on error') do
		options[:trace] = true
	end

	opts.on('-h', '--help', 'Displays Help') do
		puts opts
		exit
	end
end

parser.parse!

begin
  Environmate::App.run!(options)
rescue => e
  puts e.message
  puts e.backtrace if options[:trace]
  exit(-1)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
environmate-0.1.1 exe/environmate