lib/sous_chef/resource/file.rb in sous_chef-0.0.2 vs lib/sous_chef/resource/file.rb in sous_chef-0.0.3
- old
+ new
@@ -1,24 +1,24 @@
module SousChef
module Resource
class File < Directory
def content(content=nil)
- set_or_return(:content, content)
+ set_or_return(:content, content && content.to_s)
end
protected
def escaped_content
- content#.gsub('$', '\$')
+ content
end
def create
- not_if file_exist_command
+ not_if file_exist_command unless forced?
command create_file_command
end
def delete
- only_if file_exist_command
- command "rm #{escape_path(path)}"
+ only_if file_exist_command unless forced?
+ command "rm #{'-f ' if forced?}#{escape_path(path)}"
end
def file_exist_command
%{test -e #{escape_path(path)}}
end