Class: Psychic::Runner::CLI

Inherits:
RunnerCLI show all
Defined in:
lib/psychic/runner/cli.rb

Defined Under Namespace

Classes: List, Show

Constant Summary

Constants inherited from CLI

CLI::BUILT_IN_TASKS

Instance Method Summary collapse

Methods inherited from CLI

start

Instance Method Details

#sample(sample_name = nil) ⇒ Object



54
55
56
57
58
59
60
61
62
63
# File 'lib/psychic/runner/cli.rb', line 54

def sample(sample_name = nil)
  abort 'You must specify a sample name, run `psychic list samples` for a list of known samples' unless sample_name
  result = runner.run_sample(sample_name, *extra_args)
  if options.dry_run
    say_status :dry_run, sample_name
  else
    result.error!
    say_status :success, sample_name
  end
end

#task(task_name = nil) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/psychic/runner/cli.rb', line 27

def task(task_name = nil)
  return list_tasks if options[:list]
  abort 'You must specify a task name, run with -l for a list of known tasks' unless task_name
  result = runner.execute_task(task_name, *extra_args)
  result.error!
  say_status :success, task_name
rescue Psychic::Shell::ExecutionError => e
  say_status :failed, task_name, :red
  say e.execution_result if e.execution_result
end