Class: CobraCommander::Executor::Script

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

Overview

This is a script job. It can target any CobraCommander::Component.

Script runs the given script once for each Component#root_paths

Instance Method Summary collapse

Methods included from RunScript

#run_many, #run_script

Constructor Details

#initialize(script) ⇒ Script

Returns a new instance of Script.



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

def initialize(script)
  @script = script
end

Instance Method Details

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

Runs the script in the given component

It runs the script once for each Component#root_paths. If a component has two packages in the same path, it will run the script only once.

Parameters:

  • tty (CobraComander::Executor::IsolatedPTY)

    tty to execute shell scripts

  • component (CobraComander::Component)

    target component

Returns:

  • (Array<Symbol, String>)


24
25
26
# File 'lib/cobra_commander/executor/script.rb', line 24

def call(tty, component)
  run_many(component.root_paths) { run_script(tty, @script, _1) }
end