class RabbitWQ::Command

Attributes

options[R]

Public Class Methods

new( args ) click to toggle source
# File lib/rabbit_wq/command.rb, line 6
def initialize( args )
  @options = {
    :quiet => true,
    :pid_dir => "#{Rails.root}/tmp/pids"
  }

  opts = OptionParser.new do |opts|
    opts.banner = "Usage: #{File.basename($0)} [options] start|stop|restart"

    opts.on('-h', '--help', 'Show this message') do
      puts opts
      exit 1
    end
    opts.on('--pid-dir=DIR', 'Specifies an alternate directory in which to store the process ids.') do |dir|
      @options[:pid_dir] = dir
    end
    opts.on('-i', '--interactive', 'Start the process in interactive mode.') do |n|
      @options[:interactive] = true
    end
  end

  @args = opts.parse!( args )
end

Public Instance Methods

start() click to toggle source
# File lib/rabbit_wq/command.rb, line 30
def start
  if options[:interactive]
    start_interactive( options )
  else
    start_daemonized( options )
  end
end
start_daemonized( options ) click to toggle source
# File lib/rabbit_wq/command.rb, line 43
def start_daemonized( options )
end
start_interactive( options ) click to toggle source
# File lib/rabbit_wq/command.rb, line 38
def start_interactive( options )
  server = RabbitWQ::Server.new( options.merge( log: nil ))
  server.start
end