Module: DerivativeRodeo::Generators::CopyFileConcern

Included in:
CopyGenerator, PdfSplitGenerator
Defined in:
lib/derivative_rodeo/generators/concerns/copy_file_concern.rb

Overview

A helper module for copying files from one location to another.

Instance Method Summary collapse

Instance Method Details

#build_step(output_location:, input_tmp_file_path:) ⇒ StorageLocations::BaseLocation

Copy files from one adapter to another.

Parameters:

Returns:



14
15
16
# File 'lib/derivative_rodeo/generators/concerns/copy_file_concern.rb', line 14

def build_step(output_location:, input_tmp_file_path:, **)
  copy(input_tmp_file_path, output_location)
end

#copy(from_path, output_location) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
23
24
25
# File 'lib/derivative_rodeo/generators/concerns/copy_file_concern.rb', line 20

def copy(from_path, output_location)
  output_location.with_new_tmp_path do |out_path|
    # We can move here because we are done with the tmp file after this.
    FileUtils.mv(from_path, out_path)
  end
end