Class: Tomo::Commands::Run

Inherits:
Tomo::CLI::Command show all
Includes:
Tomo::CLI::CommonOptions, Tomo::CLI::DeployOptions, Tomo::CLI::ProjectOptions
Defined in:
lib/tomo/commands/run.rb

Instance Method Summary collapse

Methods included from Tomo::CLI::CommonOptions

included

Methods included from Tomo::CLI::ProjectOptions

included

Methods included from Tomo::CLI::DeployOptions

included

Methods inherited from Tomo::CLI::Command

after_parse, arg, option, parse, parser

Methods included from Tomo::Colors

enabled?

Instance Method Details



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/tomo/commands/run.rb', line 20

def banner
  <<~BANNER
    Usage: #{green('tomo run')} #{yellow('[--dry-run] [options] [--] TASK [ARGS...]')}

    Remotely run one specified #{yellow('TASK')}, optionally passing #{yellow('ARGS')} to that task.
    For example, if this project uses the "rails" plugin, you could run:

      #{blue('tomo run -- rails:console --sandbox')}

    This will run the #{blue('rails:console')} task on the host specified in
    #{DEFAULT_CONFIG_PATH}, and will pass the #{blue('--sandbox')} argument to that task.
    The #{blue('--')} is used to separate tomo options from options that are passed
    to the task. If a task does not accept options, the #{blue('--')} can be omitted,
    like this:

      #{blue('tomo run core:clean_releases')}

    When you specify a task name, the #{blue('run')} command is implied and can be
    omitted, so this works as well:

      #{blue('tomo core:clean_releases')}

    You can run any task defined by plugins loaded in #{DEFAULT_CONFIG_PATH}.
    To see a list of available tasks, run #{blue('tomo tasks')}.

    Tomo will auto-complete this command’s options, including the #{yellow('TASK')} name,
    if you are using bash and have tomo’s completion script installed. For
    installation instructions, run #{blue('tomo completion-script')}.

    For more documentation and examples, visit:

      #{blue('https://tomo.mattbrictson.com/commands/run')}
  BANNER
end

#call(task, options) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/tomo/commands/run.rb', line 55

def call(task, *, options)
  logger.info "tomo run v#{Tomo::VERSION}"

  runtime = configure_runtime(options)
  plan = runtime.run!(task, *, privileged: options[:privileged])
  log_completion(task, plan)
end

#summaryObject



16
17
18
# File 'lib/tomo/commands/run.rb', line 16

def summary
  "Run a specific remote task from the current project"
end