class SousChef::Resource::Execute
Public Class Methods
new(context, name=nil, &block)
click to toggle source
Calls superclass method
SousChef::Resource::Base::new
# File lib/sous_chef/resource/execute.rb, line 4 def initialize(context, name=nil, &block) super @cwd = nil end
Public Instance Methods
command(cmd)
click to toggle source
# File lib/sous_chef/resource/execute.rb, line 25 def command(cmd) @commands << cmd end
creates(path)
click to toggle source
# File lib/sous_chef/resource/execute.rb, line 29 def creates(path) not_if %{test -e #{escape_path(path)}} end
cwd(dir=nil)
click to toggle source
# File lib/sous_chef/resource/execute.rb, line 21 def cwd(dir=nil) set_or_return(:cwd, dir) end
to_script()
click to toggle source
Calls superclass method
SousChef::Resource::Base#to_script
# File lib/sous_chef/resource/execute.rb, line 10 def to_script @script ||= begin setup prepend %{cd #{escape_path(@cwd)}} if @cwd @commands = @commands.inject([]) do |result, line| result + line.split("\n") end super end end