Class: Bricolage::StreamingLoad::DispatcherOptions
- Inherits:
-
Object
- Object
- Bricolage::StreamingLoad::DispatcherOptions
- Defined in:
- lib/bricolage/streamingload/dispatcher.rb
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#log_file_path ⇒ Object
readonly
Returns the value of attribute log_file_path.
-
#pid_file_path ⇒ Object
readonly
Returns the value of attribute pid_file_path.
-
#rest_arguments ⇒ Object
readonly
Returns the value of attribute rest_arguments.
Instance Method Summary collapse
- #daemon? ⇒ Boolean
-
#initialize(argv) ⇒ DispatcherOptions
constructor
A new instance of DispatcherOptions.
- #parse ⇒ Object
- #usage ⇒ Object
Constructor Details
#initialize(argv) ⇒ DispatcherOptions
Returns a new instance of DispatcherOptions.
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/bricolage/streamingload/dispatcher.rb', line 202 def initialize(argv) @argv = argv @daemon = false @log_file_path = nil @pid_file_path = nil @rest_arguments = nil @opts = opts = OptionParser.new("Usage: #{$0} CONFIG_PATH") opts.on('--task-id=id', 'Execute oneshot load task (implicitly disables daemon mode).') {|task_id| @task_id = task_id } opts.on('-e', '--environment=NAME', "Sets execution environment [default: #{Context::DEFAULT_ENV}]") {|env| @environment = env } opts.on('--daemon', 'Becomes daemon in server mode.') { @daemon = true } opts.on('--log-file=PATH', 'Log file path') {|path| @log_file_path = path } opts.on('--pid-file=PATH', 'Creates PID file.') {|path| @pid_file_path = path } opts.on('--help', 'Prints this message and quit.') { puts opts.help exit 0 } opts.on('--version', 'Prints version and quit.') { puts "#{File.basename($0)} version #{VERSION}" exit 0 } end |
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
246 247 248 |
# File 'lib/bricolage/streamingload/dispatcher.rb', line 246 def environment @environment end |
#log_file_path ⇒ Object (readonly)
Returns the value of attribute log_file_path.
246 247 248 |
# File 'lib/bricolage/streamingload/dispatcher.rb', line 246 def log_file_path @log_file_path end |
#pid_file_path ⇒ Object (readonly)
Returns the value of attribute pid_file_path.
252 253 254 |
# File 'lib/bricolage/streamingload/dispatcher.rb', line 252 def pid_file_path @pid_file_path end |
#rest_arguments ⇒ Object (readonly)
Returns the value of attribute rest_arguments.
246 247 248 |
# File 'lib/bricolage/streamingload/dispatcher.rb', line 246 def rest_arguments @rest_arguments end |
Instance Method Details
#daemon? ⇒ Boolean
248 249 250 |
# File 'lib/bricolage/streamingload/dispatcher.rb', line 248 def daemon? @daemon end |
#parse ⇒ Object
239 240 241 242 243 244 |
# File 'lib/bricolage/streamingload/dispatcher.rb', line 239 def parse @opts.parse!(@argv) @rest_arguments = @argv.dup rescue OptionParser::ParseError => err raise OptionError, err. end |
#usage ⇒ Object
235 236 237 |
# File 'lib/bricolage/streamingload/dispatcher.rb', line 235 def usage @opts.help end |