class Bricolage::StreamingLoad::TaskHandlerOptions

Attributes

environment[R]
log_file_path[R]
pid_file_path[R]
rest_arguments[R]
task_id[R]
working_dir[R]

Public Class Methods

new(argv) click to toggle source
# File lib/bricolage/streamingload/taskhandler.rb, line 181
def initialize(argv)
  @argv = argv
  @environment = Context::DEFAULT_ENV
  @daemon = false
  @log_file_path = nil
  @pid_file_path = nil
  @working_dir = Dir.getwd
  @task_id = nil
  @force = false
  @noop = false
  @rest_arguments = nil

  @opts = opts = OptionParser.new("Usage: #{$0} CONFIG_PATH")
  opts.on('-e', '--environment=NAME', "Sets execution environment [default: #{@environment}]") {|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('--working-dir=PATH', "Loader working directory. [default: #{@working_dir}]") {|path|
    @working_dir = path
  }
  opts.on('--task-id=ID', 'Execute oneshot load task (implicitly disables daemon mode).') {|task_id|
    @task_id = task_id
  }
  opts.on('--force', 'Disables loaded check.') {|path|
    @force = true
  }
  opts.on('--noop', 'Does not execute tasks.') {
    @noop = true
  }
  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

Public Instance Methods

daemon?() click to toggle source
# File lib/bricolage/streamingload/taskhandler.rb, line 243
def daemon?
  @daemon
end
force?() click to toggle source
# File lib/bricolage/streamingload/taskhandler.rb, line 253
def force?
  @force
end
noop?() click to toggle source
# File lib/bricolage/streamingload/taskhandler.rb, line 257
def noop?
  @noop
end
parse() click to toggle source
# File lib/bricolage/streamingload/taskhandler.rb, line 232
def parse
  @opts.parse!(@argv)
  @rest_arguments = @argv.dup
rescue OptionParser::ParseError => err
  raise OptionError, err.message
end
usage() click to toggle source
# File lib/bricolage/streamingload/taskhandler.rb, line 228
def usage
  @opts.help
end