Class: Orca::Suite
- Inherits:
-
Object
- Object
- Orca::Suite
- Defined in:
- lib/orca/suite.rb
Instance Method Summary collapse
- #exec(runner, command) ⇒ Object
-
#initialize(options = {}) ⇒ Suite
constructor
A new instance of Suite.
- #load_file(file) ⇒ Object
- #run(group_name, pkg_name, command, sequential = false) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Suite
Returns a new instance of Suite.
3 4 5 6 7 |
# File 'lib/orca/suite.rb', line 3 def initialize(={}) @sequential = [:sequential] @demonstrate = [:demonstrate] @skip_dependancies = [:'skip-dependancies'] || false end |
Instance Method Details
#exec(runner, command) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/orca/suite.rb', line 31 def exec(runner, command) if @demonstrate runner.demonstrate(command) else runner.execute(command) end end |
#load_file(file) ⇒ Object
9 10 11 |
# File 'lib/orca/suite.rb', line 9 def load_file(file) Orca::DSL.module_eval(File.read(file)) end |
#run(group_name, pkg_name, command, sequential = false) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/orca/suite.rb', line 13 def run(group_name, pkg_name, command, sequential=false) group = Orca::Group.find(group_name) runners = group.nodes.map do |node| if command == :trigger Orca::TriggerRunner.new(node, pkg_name) else pkg = Orca::PackageIndex.default.get(pkg_name) Orca::Runner.new(node, pkg, @skip_dependancies) end end if @sequential runners.each {|runner| exec(runner, command) } else threads = runners.map {|runner| Thread.new { exec(runner, command) } } threads.each {|t| t.join } end end |