Class: Orca::Suite
- Inherits:
-
Object
- Object
- Orca::Suite
- Defined in:
- lib/orca/suite.rb
Instance Method Summary collapse
- #cleanup ⇒ 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 8 |
# File 'lib/orca/suite.rb', line 3 def initialize(={}) @sequential = [:sequential] @demonstrate = [:demonstrate] @skip_dependancies = [:'skip-dependancies'] || false @nodes = [] end |
Instance Method Details
#cleanup ⇒ Object
34 35 36 |
# File 'lib/orca/suite.rb', line 34 def cleanup @nodes.each(&:disconnect) end |
#load_file(file) ⇒ Object
10 11 12 |
# File 'lib/orca/suite.rb', line 10 def load_file(file) Orca::DSL.module_eval(File.read(file)) end |
#run(group_name, pkg_name, command, sequential = false) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/orca/suite.rb', line 14 def run(group_name, pkg_name, command, sequential=false) group = Orca::Group.find(group_name) raise Orca::MissingGroupError.new(group_name) if group.nil? runners = group.nodes.map do |node| @nodes << 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 |