Skip to content

Commit

Permalink
Fix options passed from cli to runners
Browse files Browse the repository at this point in the history
  • Loading branch information
localshred committed Oct 22, 2012
1 parent c419f0c commit 818cb5c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/protobuf/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class CLI < ::Thor

option :backlog, :type => :numeric, :default => 100, :aliases => %w(-b), :desc => 'Backlog for listening socket when using Socket Server.'
option :threshold, :type => :numeric, :default => 100, :aliases => %w(-t), :desc => 'Multi-threaded Socket Server cleanup threshold.'
option :threads, :type => :numeric, :default => 5, :aliases => %w(-r), :desc => 'Number of worker threads to run. Only applicable in --zmq mode.'

option :log, :type => :string, :aliases => %w(-l), :desc => 'Log file or device. Default is STDOUT.'
option :level, :type => :numeric, :default => ::Logger::INFO, :aliases => %w(-v), :desc => 'Log level to use, 0-5 (see http://www.ruby-doc.org/stdlib/libdoc/logger/rdoc/)'
Expand All @@ -33,6 +34,7 @@ class CLI < ::Thor
option :print_deprecation_warnings, :type => :boolean, :default => true, :desc => 'Cause use of deprecated fields to be printed or ignored.'

def start(app_file)
puts 'RUNNING FROM LOCAL'
debug_say 'Configuring the rpc_server process'
@start_aborted = false

Expand Down Expand Up @@ -153,6 +155,14 @@ def run_if_no_abort
yield unless @start_aborted
end

def runner_options
{ :host => options.host,
:port => options.port,
:backlog => options.backlog,
:treshold => options.threshold,
:threads => options.threads }
end

def say_and_exit!(message, exception = nil)
message = set_color(message, :red) if ::Protobuf::Logger.file == STDOUT

Expand All @@ -168,7 +178,7 @@ def say_and_exit!(message, exception = nil)
# Start the runner and log the relevant options.
def start_server!
debug_say 'Invoking server start'
@runner.run(options.dup) do
@runner.run(runner_options) do
Protobuf::Logger.info { "pid #{::Process.pid} -- #{@mode} RPC Server listening at #{options.host}:#{options.port}" }
end
end
Expand Down

0 comments on commit 818cb5c

Please sign in to comment.