Skip to content

Commit

Permalink
Update dependencies which saves and retreives charset
Browse files Browse the repository at this point in the history
Specifically for the extracted text.

Fixes #1089
  • Loading branch information
jcoyne committed Jun 15, 2017
1 parent ecef98c commit 031912d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,13 @@ module Hyrax
# This Service is an implementation of the Hydra::Derivatives::PersistOutputFileService
# It supports directly contained files
class PersistDirectlyContainedOutputFileService < Hydra::Derivatives::PersistBasicContainedOutputFileService
# This method conforms to the signature of the .call method on Hydra::Derivatives::PersistOutputFileService
# * Persists the file within the DirectContainer specified by :container
#
# @param [String] the data to be persisted
# @param [Hash] directives directions which can be used to determine where to persist to.
# @option directives [String] url URI for the parent object.
# @option directives [String] container Name of the container association.
def self.call(string, directives)
file = Hydra::Derivatives::IoDecorator.new(string, new_mime_type(directives.fetch(:format)))
o_name = determine_original_name(file)
m_type = determine_mime_type(file)
# Overriding to get the file in the direct container.
# @return [ActiveFedora::File]
def self.retrieve_remote_file(directives)
uri = URI(directives.fetch(:url))
raise ArgumentError, "#{uri} is not an http(s) uri" unless uri.is_a?(URI::HTTP)
file_set = ActiveFedora::Base.find(ActiveFedora::Base.uri_to_id(uri.to_s))
remote_file = file_set.send("build_#{directives.fetch(:container)}".to_sym)
remote_file.content = file
remote_file.mime_type = m_type
remote_file.original_name = o_name
file_set.save
file_set.public_send("build_#{directives.fetch(:container)}".to_sym)
end
end
end
3 changes: 2 additions & 1 deletion hyrax.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ EOF
spec.add_dependency 'hydra-head', '>= 10.5.0'
spec.add_dependency 'hydra-editor', '~> 3.3'
spec.add_dependency 'hydra-works', '~> 0.16'
spec.add_dependency 'hydra-derivatives', '~> 3.3'
spec.add_dependency 'browse-everything', '>= 0.10.5'
spec.add_dependency 'blacklight', '~> 6.9'
spec.add_dependency 'blacklight-gallery', '~> 0.7'
Expand Down Expand Up @@ -69,7 +70,7 @@ EOF
spec.add_dependency 'dry-struct', '~> 0.1'
spec.add_dependency 'redlock', '>= 0.1.2'
spec.add_dependency 'retriable', '>= 2.9', '< 4.0'
spec.add_dependency 'active-fedora', '>= 11.1.3'
spec.add_dependency 'active-fedora', '>= 11.3.1'
spec.add_dependency 'linkeddata' # Required for getting values from geonames

spec.add_development_dependency 'engine_cart', '~> 1.0'
Expand Down

0 comments on commit 031912d

Please sign in to comment.