class Oncall::Options
Attributes
config[W]
env[W]
exclude[RW]
group[RW]
host[RW]
path[RW]
pattern[RW]
persist[RW]
port[RW]
runner[W]
verbose[RW]
Public Class Methods
new()
click to toggle source
# File lib/oncall/options.rb, line 13 def initialize @env = nil @pattern = default_pattern @exclude = '' @group = nil @persist = nil @path = nil @verbose = default_verbosity @host = default_host @port = default_port end
Public Instance Methods
config()
click to toggle source
# File lib/oncall/options.rb, line 29 def config @config ||= config_default end
env()
click to toggle source
# File lib/oncall/options.rb, line 33 def env @env ||= default_env end
parse_config()
click to toggle source
# File lib/oncall/options.rb, line 37 def parse_config conf_file = load_config_file set_default_env conf_file update_options conf_file end
runner()
click to toggle source
# File lib/oncall/options.rb, line 25 def runner @runner ||= Oncall::Invocations::TestRunner.new end
Private Instance Methods
config_default()
click to toggle source
# File lib/oncall/options.rb, line 83 def config_default File.join(Dir.pwd, config_file_name) end
config_file_name()
click to toggle source
# File lib/oncall/options.rb, line 87 def config_file_name 'oncall.yml' end
default_env()
click to toggle source
# File lib/oncall/options.rb, line 67 def default_env 'develop' end
default_host()
click to toggle source
# File lib/oncall/options.rb, line 71 def default_host 'localhost' end
default_pattern()
click to toggle source
# File lib/oncall/options.rb, line 63 def default_pattern '**{,/*/**}/*_oncall.rb' end
default_port()
click to toggle source
# File lib/oncall/options.rb, line 75 def default_port 3000 end
default_verbosity()
click to toggle source
# File lib/oncall/options.rb, line 79 def default_verbosity false end
load_config_file()
click to toggle source
# File lib/oncall/options.rb, line 59 def load_config_file YAML.load_file(config) end
set_default_env(conf_file)
click to toggle source
# File lib/oncall/options.rb, line 53 def set_default_env(conf_file) return if @env @env = conf_file['default'] if conf_file.key? 'default' end
update_options(conf_file)
click to toggle source
# File lib/oncall/options.rb, line 46 def update_options(conf_file) raise "Expected env '#{env}' does not exist in config" unless conf_file.key? env @domain = conf_file[env]['domain'] if conf_file[env].key? 'domain' @port = conf_file[env]['port'] if conf_file[env].key? 'port' end