Class: Producer::Core::Actions::FileAppend

Inherits:
Producer::Core::Action show all
Defined in:
lib/producer/core/actions/file_append.rb

Constant Summary

Constants inherited from Producer::Core::Action

Producer::Core::Action::INSPECT_ARGUMENTS_SUM_LEN

Instance Attribute Summary

Attributes inherited from Producer::Core::Action

#arguments, #env, #options

Instance Method Summary collapse

Methods inherited from Producer::Core::Action

#initialize, #to_s

Constructor Details

This class inherits a constructor from Producer::Core::Action

Instance Method Details

#applyObject



14
15
16
# File 'lib/producer/core/actions/file_append.rb', line 14

def apply
  fs.file_write @path, combined_content
end

#combined_contentObject



18
19
20
21
22
23
# File 'lib/producer/core/actions/file_append.rb', line 18

def combined_content
  original_content = fs.file_read @path

  return @content unless original_content
  original_content + @content
end

#nameObject



10
11
12
# File 'lib/producer/core/actions/file_append.rb', line 10

def name
  'file_append'
end

#setupObject



5
6
7
8
# File 'lib/producer/core/actions/file_append.rb', line 5

def setup
  check_arguments_size! 2
  @path, @content = arguments
end