Class: CobraCommander::Executor::Command

Inherits:
Object
  • Object
show all
Includes:
PackageCriteria, RunScript
Defined in:
lib/cobra_commander/executor/command.rb

Constant Summary collapse

SKIP_UNEXISTING =
"Command %s does not exist. Check your cobra.yml for existing commands in %s."
SKIP_CRITERIA =
"Package %s does not match criteria."

Instance Method Summary collapse

Methods included from RunScript

#run_many, #run_script

Methods included from PackageCriteria

#_match_depends_on?, #match_criteria?

Constructor Details

#initialize(command_name) ⇒ Command

Returns a new instance of Command.



12
13
14
# File 'lib/cobra_commander/executor/command.rb', line 12

def initialize(command_name)
  @command_name = command_name
end

Instance Method Details

#call(tty, package) ⇒ Array<Symbol, String>

Calls the commands sequentially, stopping ony if an :error happens.

If one of the commands skips, the result will be :success.

Parameters:

  • tty (CobraComander::Executor::IsolatedPTY)

    tty to execute shell scripts

  • package (CobraComander::Package)

    target package to execute the named command

Returns:

  • (Array<Symbol, String>)


23
24
25
# File 'lib/cobra_commander/executor/command.rb', line 23

def call(tty, package)
  run_command tty, package, @command_name
end