summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a494600)
We want to make sure we don't build the contents until the resource
is asctually being run, as it may rely on template files installed by
a previous resource.
+ class Util
+ class EditedFile
+ def initialize(file, block)
+ @file = file
+ @block = block
+ end
+
+ def to_s
+ ::File.new(@file).collect do |line|
+ line = @block.call(line)
+ end.join("")
+ end
+ end
+ end
+
class Recipe
def edit_file(file, &block)
class Recipe
def edit_file(file, &block)
- ::File.new(file).collect do |line|
- line = yield line
- end.join("")
+ Chef::Util::EditedFile.new(file, block)