Sha256: b85b7b3c4025ec3247d7ca11e6736041d6dc6e538a08b50b5d9f921a0e4961e5

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

#!/usr/bin/env ruby

require 'rubygems'
require 'react'
require 'optparse'
require 'daemons'

if ARGV.empty?
  ARGV << '--help'
else 
  if File.exists?(ARGV[0])
    options[:commands] = YAML.load_file(ARGV[0])
  else
    puts "ERROR: File not found: `#{ARGV[0]}`"
    exit
  end
end

options = { 
  :redis => {:host => '127.0.0.1', :port => 6379, :db => 0}, 
  :commands => {}, 
  :queue => 'queue' 
}

opts = OptionParser.new do |opts|
  opts.banner = "Usage: react commands.yml [options]"
  opts.on('-q', '--queue [QUEUE]', 'Specify queue which will be consumed') {|val| val and options[:queue] = val }
  opts.on('-h', '--host [HOST]', 'Select redis host') {|val| val and options[:redis][:host] = val }
  opts.on('-p', '--port [PORT]', Integer, 'Select redis port') {|val| val and options[:redis][:port] = val }
  opts.on('-D', '--db [DATABASE]', 'Select redis database number') {|val| val and options[:redis][:db] = val }
  opts.on('-P', '--password [PASSWORD]', 'Select redis database password') {|val| val and options[:redis][:password] = val }  
  opts.on('-d', '--daemon', 'Run in background') { options[:daemon] = true }
end.parse(ARGV)

React.start(options).join

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
react-0.0.2 bin/react