class DeepTest::Options
Constants
Public Class Methods
from_command_line(command_line)
click to toggle source
# File lib/deep_test/options.rb, line 27 def self.from_command_line(command_line) hash = {} VALID_OPTIONS.each do |option| hash[option.name] = option.from_command_line(command_line) end new(hash) end
new(hash)
click to toggle source
# File lib/deep_test/options.rb, line 35 def initialize(hash) @origin_hostname = Socket.gethostname check_option_keys(hash) VALID_OPTIONS.each do |option| send("#{option.name}=", hash[option.name] || option.default) end end
Public Instance Methods
gathering_metrics?()
click to toggle source
# File lib/deep_test/options.rb, line 43 def gathering_metrics? !@metrics_file.nil? end
mirror_path(base)
click to toggle source
# File lib/deep_test/options.rb, line 76 def mirror_path(base) raise "No source directory specified in sync_options" unless sync_options[:source] relative_mirror_path = origin_hostname + sync_options[:source].gsub('/','_') "#{base}/#{relative_mirror_path}" end
new_listener_list()
click to toggle source
# File lib/deep_test/options.rb, line 47 def new_listener_list listeners = worker_listener.split(',').map do |listener| eval(listener).new end ListenerList.new(listeners) end
new_workers()
click to toggle source
# File lib/deep_test/options.rb, line 82 def new_workers if distributed_server.nil? LocalWorkers.new self else begin server = Distributed::TestServer.connect(self) Distributed::RemoteWorkerClient.new(self, server, LocalWorkers.new(self)) rescue => e ui_instance.distributed_failover_to_local("connect", e) LocalWorkers.new self end end end
origin_hostname()
click to toggle source
# File lib/deep_test/options.rb, line 54 def origin_hostname (Socket.gethostname == @origin_hostname) ? 'localhost' : @origin_hostname end
server()
click to toggle source
# File lib/deep_test/options.rb, line 96 def server Server.remote_reference(origin_hostname, server_port) end
to_command_line()
click to toggle source
# File lib/deep_test/options.rb, line 67 def to_command_line command_line = [] VALID_OPTIONS.each do |option| value = send(option.name) command_line << option.to_command_line(value) end command_line.compact.join(' ') end
ui=(value)
click to toggle source
# File lib/deep_test/options.rb, line 19 def ui=(value) @ui = value.to_s end
ui_instance()
click to toggle source
# File lib/deep_test/options.rb, line 63 def ui_instance UI_INSTANCES[self] ||= eval(ui).new(self) end
worker_listener=(value)
click to toggle source
# File lib/deep_test/options.rb, line 23 def worker_listener=(value) @worker_listener = value.to_s end
Protected Instance Methods
check_option_keys(hash)
click to toggle source
# File lib/deep_test/options.rb, line 102 def check_option_keys(hash) hash.keys.each do |key| raise InvalidOptionError.new(key) unless VALID_OPTIONS.any? {|o| o.name == key.to_sym} end end