Class: Resource::Execute
Instance Method Summary collapse
- #command(string) ⇒ Object
-
#initialize(title, &block) ⇒ Execute
constructor
A new instance of Execute.
- #run ⇒ Object
Methods inherited from Base
inherited, #not_if, #set_base_defaults, #should_skip?, #unix_mode
Methods included from ClassAttr
Methods included from BlockAttr
Constructor Details
#initialize(title, &block) ⇒ Execute
Returns a new instance of Execute.
7 8 9 10 11 12 13 |
# File 'lib/resource/execute.rb', line 7 def initialize title, &block set_base_defaults @path = nil @commands = [] @title = title self.instance_eval(&block) end |
Instance Method Details
#command(string) ⇒ Object
15 16 17 |
# File 'lib/resource/execute.rb', line 15 def command string @commands << { :command => string, :path => @path } end |
#run ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/resource/execute.rb', line 19 def run Execution.block 'Execution', @title, @owner do |b| b.always_run @always_run @commands.each do |command_hash| b.run "#{command_hash[:command]}", command_hash[:path] end end end |