Sha256: 71fea7dfbd22665496c2d38fae4653f4eea693bc78515974e0545387ae8e67bb

Contents?: true

Size: 1.64 KB

Versions: 4

Compression:

Stored size: 1.64 KB

Contents

#!/usr/bin/ruby

# = Boned
# 
#
# Usage:
# 
#     $ boned -h
#     $ boned [-d] start-master
#
#--

# Put our local lib in first place
BASE_PATH = File.expand_path File.join(File.dirname(__FILE__), '..')
lib_dir = File.join(BASE_PATH, 'lib')
$:.unshift lib_dir  
#$:.unshift '/Users/delano/Projects/opensource/drydock/lib'

require 'drydock'
require 'boned'
require 'boned/cli'

# Command-line interface for bin/stella
class Boned::CLI::Definition
  extend Drydock

  debug :off
  
  default :info
  
  global :V, :version, "Display version" do
    puts "Boned: #{Boned::VERSION} (api: #{Boned::APIVERSION})"
    exit
  end
  
  global :R, :rackup, String, "Specify a rackup file"
  global :e, :environment, String, "Rack environment"
  global :v, :verbose, "Increase output" do; 1 end
  global :d, :daemon, "Run as a daemon"
  global :p, :port, Integer, "Port to run on"
  global :D, :debug do
    Drydock.debug true
    Boned.enable_debug
  end
  
  command :start => Boned::CLI
  command :stop => Boned::CLI
  command :stop_redis => Boned::CLI
  command :info => Boned::CLI
  
end

  
begin
  Drydock.run!(ARGV, STDIN) if Drydock.run? && !Drydock.has_run?
rescue Boned::Problem => ex
  STDERR.puts ex.message
  STDERR.puts ex.backtrace if Drydock.debug?
  exit 1
rescue Drydock::ArgError, Drydock::OptError => ex
  STDERR.puts ex.message
  STDERR.puts ex.usage
rescue Drydock::InvalidArgument => ex
  STDERR.puts ex.message
rescue Drydock::UnknownCommand => ex
  STDERR.puts "Unknown command: %s" % ex.name
rescue Interrupt
  puts $/, "Exiting... "
  exit 1
rescue => ex
  STDERR.puts "ERROR (#{ex.class.to_s}): #{ex.message}"
  STDERR.puts ex.backtrace if Drydock.debug?
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
boned-0.2.5 bin/boned
boned-0.2.4 bin/boned
boned-0.2.3 bin/boned
boned-0.2.2 bin/boned