Class: Locd::CLI::Command::Job

Inherits:
Agent
  • Object
show all
Defined in:
lib/locd/cli/command/job.rb,
lib/locd/cli/command/job/add.rb

Overview

Definitions

Direct Known Subclasses

RotateLogs

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Agent

agent_type, #ls, #open, #plist, #restart, #rm, #start, #status, #stop, #tail, #truncate_logs, #update

Class Method Details

.agent_classObject

Helpers



38
39
40
# File 'lib/locd/cli/command/job.rb', line 38

def self.agent_class
  Locd::Agent::Job
end

.parse_every_option(value) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/locd/cli/command/job.rb', line 42

def self.parse_every_option value
  case value
  when /\A\d+\z/, /\A\d+s\z/
    value.to_i
  when /\A\d+m\z/
    value[0...-1].to_i * 60
  when /\A\d+h\z/
    value[0...-1].to_i * 60 * 60
  when /\A\d+d\z/
    value[0...-1].to_i * 60 * 60 * 24
  else
    raise ArgumentError,
      "Can't parse `every` option value: #{ value.inspect }"
  end
end

Instance Method Details

#add(*cmd_template, **kwds) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/locd/cli/command/job/add.rb', line 37

def add           *cmd_template, **kwds
  logger.trace "#{ self.class.name }##{ __method__ }",
    options: options,
    cmd_template: cmd_template,
    kwds: kwds,
    shared: self.class.shared_method_options
  
  kwds[:start_interval] ||= get_start_interval
  
  super *cmd_template, **kwds
end