Class: Jobly::Commands::RunCmd

Inherits:
Base
  • Object
show all
Defined in:
lib/jobly/commands/run.rb

Instance Method Summary collapse

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/jobly/commands/run.rb', line 17

def run
  job = args['JOB']
  params = args['PARAMS'].to_params.convert_to_typed
  job_class = Jobs.get_class! job

  if args['--later']
    say "Scheduling g`#{job_class}`"
    if params.empty?
      job_class.run_later
    else
      job_class.run_later params
    end

  else
    say "Running g`#{job_class}`"
    job_class.run params
  end
end