Class: Whisk::Runner
- Inherits:
-
Object
- Object
- Whisk::Runner
- Defined in:
- lib/whisk/runner.rb
Instance Attribute Summary collapse
-
#bowls ⇒ Object
Returns the value of attribute bowls.
Instance Method Summary collapse
-
#initialize(whiskfile = Whisk::DEFAULT_FILENAME, filter = nil) ⇒ Runner
constructor
A new instance of Runner.
- #run(action) ⇒ Object
Constructor Details
#initialize(whiskfile = Whisk::DEFAULT_FILENAME, filter = nil) ⇒ Runner
Returns a new instance of Runner.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/whisk/runner.rb', line 27 def initialize(whiskfile=Whisk::DEFAULT_FILENAME, filter=nil) @bowls = Whisk::WhiskFile.from_file(whiskfile).bowls if filter bowl, ingredient = filter.split('/') if bowl bowls.delete_if {|k,v| !k.to_s.match(/^#{bowl}$/)} if ingredient bowls.each do |name, b| bowls[name].ingredients.delete_if {|k,v| !k.to_s.match(/^#{ingredient}$/)} end end end end end |
Instance Attribute Details
#bowls ⇒ Object
Returns the value of attribute bowls.
25 26 27 |
# File 'lib/whisk/runner.rb', line 25 def bowls @bowls end |
Instance Method Details
#run(action) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/whisk/runner.rb', line 43 def run(action) @bowls.each do |name, bowl| begin bowl.run_action(action) rescue Exception => e Whisk.ui.error "Caught exception while running action #{action} on bowl #{bowl.name}" Whisk.ui.output e. Whisk.ui.output e.backtrace exit 1 end end end |