Sha256: 612deb5bb1dd22d8e1559ec0713efb205f68025c36cf21e2beb9dd904cf8dca7

Contents?: true

Size: 1.9 KB

Versions: 4

Compression:

Stored size: 1.9 KB

Contents

#!/usr/bin/env ruby
require 'rubygems'
require 'controller'
require 'provider'
require 'optparse'

options = {}
OptionParser.new do |opts|
  opts.banner = "Usage: controller [options]"
  opts.separator ""
  opts.separator "Advanced Options:"
  opts.on("-h", "--drb HOST",
          "Specify the DRb host for this controller to bind to.") do |h|
    options[:drb_server_host] = h || nil
  end
  opts.on("-p", "--drb-port PORT",
          "Specify the DRb port for this controller to listen on.") do |p|
      options[:drb_server_port] = p
  end
  opts.on("-H", "--ring-server HOST",
          "Specify the ring server host for this controller to bind to.") do |h|
    options[:ring_server_host] = h || nil
  end
  opts.on("-P", "--ring-server-port PORT",
          "Specify the ring server port for this controller to listen on.") do |p|
    options[:ring_server_port] = p
  end
  opts.on("-a", "--access-control-list ACL", Array,
    "Specify a comma separated Access Control List.") do |a|
      options[:acls] = a
  end
  opts.on("-l", "--log LEVEL",
          "Specify the logging level:",
          "  - DEBUG",
          "  - INFO",
          "  - ERROR") do |l|
    case l
    when 'DEBUG'
      options[:loglevel] = Logger::DEBUG
    when 'INFO'
      options[:loglevel] = Logger::INFO
    when 'ERROR'
      options[:loglevel] = Logger::ERROR
    else
      options[:loglevel] = Logger::ERROR
    end
  end
  opts.on_tail("-h", "--help", "Show this message") do
    puts opts
    exit
  end
  end.parse!

controller = Controller.new(
  :drb_server_host  => options[:drb_server_host],
  :drb_server_port  => options[:drb_server_port]  || 11235,
  :ring_server_host => options[:ring_server_host],
  :ring_server_port => options[:ring_server_port] || 12358,
  :acls => options[:acls] || %w{ allow all },
  :loglevel => options[:loglevel]
)
controller.start
DRb.thread.join

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
watirgrid-1.1.5 bin/controller
watirgrid-1.1.4 bin/controller
watirgrid-1.1.4.pre bin/controller
watirgrid-1.1.3 bin/controller