Class: Hyrax::WorkingDirectory Deprecated
- Inherits:
-
Object
- Object
- Hyrax::WorkingDirectory
- Defined in:
- app/services/hyrax/working_directory.rb
Overview
Deprecated.
Use JobIoWrapper instead
Class Method Summary collapse
-
.copy_repository_resource_to_working_directory(file, id) ⇒ String
Path of the working file.
-
.find_or_retrieve(repository_file_id, id, filepath = nil) ⇒ String
Returns the file passed as filepath if that file exists.
Class Method Details
.copy_repository_resource_to_working_directory(file, id) ⇒ String
Returns path of the working file.
25 26 27 28 29 |
# File 'app/services/hyrax/working_directory.rb', line 25 def copy_repository_resource_to_working_directory(file, id) Rails.logger.debug "Loading #{file.original_name} (#{file.id}) from the repository to the working directory" # TODO: this causes a load into memory, which we'd like to avoid copy_stream_to_working_directory(id, file.original_name, StringIO.new(file.content)) end |
.find_or_retrieve(repository_file_id, id, filepath = nil) ⇒ String
Returns the file passed as filepath if that file exists. Otherwise it grabs the file from repository, puts it on the disk and returns that path.
11 12 13 14 15 16 17 18 19 20 |
# File 'app/services/hyrax/working_directory.rb', line 11 def find_or_retrieve(repository_file_id, id, filepath = nil) return filepath if filepath && File.exist?(filepath) repository_file = Hydra::PCDM::File.find(repository_file_id) working_path = full_filename(id, repository_file.original_name) if File.exist?(working_path) Rails.logger.debug "#{repository_file.original_name} already exists in the working directory at #{working_path}" return working_path end copy_repository_resource_to_working_directory(repository_file, id) end |