class ResqueAdmin::Scheduler::Cli
Constants
- BANNER
- OPTIONS
Attributes
argv[R]
env[R]
Public Class Methods
new(argv = ARGV, env = ENV)
click to toggle source
# File lib/resque/scheduler/cli.rb, line 83 def initialize(argv = ARGV, env = ENV) @argv = argv @env = env end
run!(argv = ARGV, env = ENV)
click to toggle source
# File lib/resque/scheduler/cli.rb, line 79 def self.run!(argv = ARGV, env = ENV) new(argv, env).run! end
Public Instance Methods
parse_options()
click to toggle source
# File lib/resque/scheduler/cli.rb, line 99 def parse_options option_parser.parse!(argv.dup) end
pre_run()
click to toggle source
# File lib/resque/scheduler/cli.rb, line 93 def pre_run parse_options pre_setup setup_env end
pre_setup()
click to toggle source
# File lib/resque/scheduler/cli.rb, line 103 def pre_setup if options[:initializer_path] load options[:initializer_path].to_s.strip else false end end
run!()
click to toggle source
# File lib/resque/scheduler/cli.rb, line 88 def run! pre_run run_forever end
run_forever()
click to toggle source
# File lib/resque/scheduler/cli.rb, line 116 def run_forever ResqueAdmin::Scheduler.run end
setup_env()
click to toggle source
# File lib/resque/scheduler/cli.rb, line 111 def setup_env require_relative 'env' runtime_env.setup end
Private Instance Methods
option_parser()
click to toggle source
# File lib/resque/scheduler/cli.rb, line 128 def option_parser OptionParser.new do |opts| opts.banner = BANNER opts.version = ResqueAdmin::Scheduler::VERSION OPTIONS.each do |opt| opts.on(*opt[:args], &opt[:callback].call(options)) end end end
options()
click to toggle source
# File lib/resque/scheduler/cli.rb, line 138 def options @options ||= {}.tap do |o| CLI_OPTIONS_ENV_MAPPING.each do |key, envvar| o[key] = env[envvar] if env.include?(envvar) end end end
runtime_env()
click to toggle source
# File lib/resque/scheduler/cli.rb, line 124 def runtime_env @runtime_env ||= ResqueAdmin::Scheduler::Env.new(options) end