Implement `file_replace_content' task action

This commit is contained in:
Thibault Jouan
2014-03-05 01:59:38 +00:00
parent a7f6d7034b
commit d22b023ff4
7 changed files with 116 additions and 3 deletions

View File

@@ -0,0 +1,27 @@
module Producer
module Core
module Actions
class FileReplaceContent < Action
def apply
fs.file_write path, replaced_content
end
def path
arguments[0]
end
def pattern
arguments[1]
end
def replacement
arguments[2]
end
def replaced_content
fs.file_read(path).gsub pattern, replacement
end
end
end
end
end