Class: Bricolage::StreamingLoad::TaskHandlerOptions
- Inherits:
-
Object
- Object
- Bricolage::StreamingLoad::TaskHandlerOptions
- Defined in:
- lib/bricolage/streamingload/taskhandler.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.
-
#task_id ⇒ Object
readonly
Returns the value of attribute task_id.
-
#working_dir ⇒ Object
readonly
Returns the value of attribute working_dir.
Instance Method Summary collapse
- #daemon? ⇒ Boolean
- #force? ⇒ Boolean
-
#initialize(argv) ⇒ TaskHandlerOptions
constructor
A new instance of TaskHandlerOptions.
- #noop? ⇒ Boolean
- #parse ⇒ Object
- #usage ⇒ Object
Constructor Details
#initialize(argv) ⇒ TaskHandlerOptions
Returns a new instance of TaskHandlerOptions.
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/bricolage/streamingload/taskhandler.rb', line 178 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 |
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
238 239 240 |
# File 'lib/bricolage/streamingload/taskhandler.rb', line 238 def environment @environment end |
#log_file_path ⇒ Object (readonly)
Returns the value of attribute log_file_path.
244 245 246 |
# File 'lib/bricolage/streamingload/taskhandler.rb', line 244 def log_file_path @log_file_path end |
#pid_file_path ⇒ Object (readonly)
Returns the value of attribute pid_file_path.
245 246 247 |
# File 'lib/bricolage/streamingload/taskhandler.rb', line 245 def pid_file_path @pid_file_path end |
#rest_arguments ⇒ Object (readonly)
Returns the value of attribute rest_arguments.
236 237 238 |
# File 'lib/bricolage/streamingload/taskhandler.rb', line 236 def rest_arguments @rest_arguments end |
#task_id ⇒ Object (readonly)
Returns the value of attribute task_id.
248 249 250 |
# File 'lib/bricolage/streamingload/taskhandler.rb', line 248 def task_id @task_id end |
#working_dir ⇒ Object (readonly)
Returns the value of attribute working_dir.
246 247 248 |
# File 'lib/bricolage/streamingload/taskhandler.rb', line 246 def working_dir @working_dir end |
Instance Method Details
#daemon? ⇒ Boolean
240 241 242 |
# File 'lib/bricolage/streamingload/taskhandler.rb', line 240 def daemon? @daemon end |
#force? ⇒ Boolean
250 251 252 |
# File 'lib/bricolage/streamingload/taskhandler.rb', line 250 def force? @force end |
#noop? ⇒ Boolean
254 255 256 |
# File 'lib/bricolage/streamingload/taskhandler.rb', line 254 def noop? @noop end |
#parse ⇒ Object
229 230 231 232 233 234 |
# File 'lib/bricolage/streamingload/taskhandler.rb', line 229 def parse @opts.parse!(@argv) @rest_arguments = @argv.dup rescue OptionParser::ParseError => err raise OptionError, err. end |
#usage ⇒ Object
225 226 227 |
# File 'lib/bricolage/streamingload/taskhandler.rb', line 225 def usage @opts.help end |