Class: ModifyFile

Inherits:
EdrGenBase show all
Defined in:
lib/edr_gen/modify_file.rb

Constant Summary collapse

ACTIVITY =
"file_changes"

Constants included from YamlLogger

YamlLogger::LOG_DIRECTORY

Instance Method Summary collapse

Methods included from YamlLogger

write

Constructor Details

#initialize(args) ⇒ ModifyFile

Returns a new instance of ModifyFile.



6
7
8
9
10
11
12
13
14
# File 'lib/edr_gen/modify_file.rb', line 6

def initialize(args)
  @filepath = args[0]
  @content  = args[1..-1].join(" ")
  command   = ["echo #{new_content} >> #{filepath}"]

  validate_args

  super(command)
end

Instance Method Details

#callObject



16
17
18
19
20
# File 'lib/edr_gen/modify_file.rb', line 16

def call
  puts "  Attempting to modify file..."
  execute_process
  puts "  File modified: #{filepath}"
end