Sha256: 609c950c7f8a8f1623df36d02faac7e3c93d8b97adfebdc8ac41504da52a571c

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

#!/usr/bin/env ruby
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

ARGV << '--help' if ARGV.empty?

require 'optparse'
require 'rapnd'
require 'rubygems' unless defined?(Gem)
require 'forever'

options = {}
OptionParser.new do |opts|
  opts.banner = "Usage: rapnd [options]"

  opts.on("--cert=MANDATORY", "Location of the cert pem file") do |cert|
    options[:cert] = cert
  end

  opts.on("--password=OPTIONAL", "Password for the cert pem file") do |password|
    options[:password] = password
  end

  opts.on("--redis_host=OPTIONAL", "Redis hostname") do |host|
    options[:redis_host] = host
  end
  
  opts.on("--redis_port=OPTIONAL", "Redis port") do |port|
    options[:redis_port] = port
  end
  
  opts.on("--environment=OPTIONAL", "Specify sandbox or production") do |env|
    options[:env] = env
  end
  
  opts.on("--queue=OPTIONAL", "Name of the redis queue") do |queue|
    options[:queue] = queue
  end
  
  opts.on("--foreground", "Run in the foreground") do |fore|
    options[:foreground] = true
  end
  
  opts.on('--help', 'Show help') do |help|
    puts opts
  end
end.parse!

unless options[:foreground]
  Forever.run do
    log "#{options[:queue]}.log"
    
    on_ready do
      Rapnd::Daemon.new(options).run!
    end
  end
else
  Rapnd::Daemon.new(options).run!
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rapnd-0.1.1 bin/rapnd
rapnd-0.1.0 bin/rapnd