Method: CommandJob#copy_file

Defined in:
lib/app/models/command_job.rb

#copy_file(from_path, to_path) ⇒ Object

Copy a given file to a new location and record the log



270
271
272
273
274
275
276
277
278
279
# File 'lib/app/models/command_job.rb', line 270

def copy_file(from_path, to_path)
  if File.exist? from_path
    FileUtils.cp(from_path, to_path)
    add_log "Copy file from: #{from_path} to: #{to_path}"
  else
    add_log "File not found: #{from_path}, copy not performed"
  end
rescue StandardError => error
  raise "Unable to copy file from #{from_path} to #{to_path}, error: ##{error.message}"
end