Implement `file_append' task action
This commit is contained in:
23
lib/producer/core/actions/file_append.rb
Normal file
23
lib/producer/core/actions/file_append.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
module Producer
|
||||
module Core
|
||||
module Actions
|
||||
class FileAppend < Action
|
||||
def apply
|
||||
fs.file_write path, combined_content
|
||||
end
|
||||
|
||||
def path
|
||||
arguments[0]
|
||||
end
|
||||
|
||||
def content
|
||||
arguments[1]
|
||||
end
|
||||
|
||||
def combined_content
|
||||
fs.file_read(path) + content
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@@ -13,9 +13,11 @@ module Producer
|
||||
define_action :echo, Actions::Echo
|
||||
define_action :sh, Actions::ShellCommand
|
||||
|
||||
define_action :mkdir, Actions::Mkdir
|
||||
define_action :file_write, Actions::FileWriter
|
||||
define_action :mkdir, Actions::Mkdir
|
||||
|
||||
define_action :file_append, Actions::FileAppend
|
||||
define_action :file_replace_content, Actions::FileReplaceContent
|
||||
define_action :file_write, Actions::FileWriter
|
||||
|
||||
attr_reader :env, :block, :actions
|
||||
|
||||
|
Reference in New Issue
Block a user