lib/itamae/resource/local_ruby_block.rb in itamae-1.13.1 vs lib/itamae/resource/local_ruby_block.rb in itamae-1.14.0
- old
+ new
@@ -3,10 +3,16 @@
class LocalRubyBlock < Base
define_attribute :action, default: :run
define_attribute :block, type: Proc
def action_run(options)
- attributes.block.call
+ if attributes[:cwd]
+ Dir.chdir(attributes[:cwd]) do
+ attributes.block.call
+ end
+ else
+ attributes.block.call
+ end
end
end
end
end