lib/ddr/models.rb in ddr-models-2.6.2 vs lib/ddr/models.rb in ddr-models-2.7.0.rc1

- old
+ new

@@ -1,13 +1,9 @@ require 'ddr/models/engine' require 'ddr/models/version' - -# Awful hack to make Hydra::AccessControls::Permissions accessible -$: << Gem.loaded_specs['hydra-access-controls'].full_gem_path + "/app/models/concerns" - +require 'action_view' # https://github.com/haml/haml/issues/695 require 'active_record' - require 'hydra-core' require 'hydra/validations' module Ddr extend ActiveSupport::Autoload @@ -17,11 +13,10 @@ autoload :Auth autoload :Datastreams autoload :Derivatives autoload :Events autoload :Index - autoload :Jobs autoload :Managers autoload :Metadata autoload :Notifications autoload :Utils autoload :Vocab @@ -37,13 +32,13 @@ end module Models extend ActiveSupport::Autoload - autoload :AccessControllable autoload :AdminSet autoload :Base + autoload :Cache autoload :ChecksumInvalid, 'ddr/models/error' autoload :Contact autoload :ContentModelError, 'ddr/models/error' autoload :DerivativeGenerationFailure, 'ddr/models/error' autoload :Describable @@ -56,18 +51,18 @@ autoload :Governable autoload :HasAdminMetadata autoload :HasAttachments autoload :HasChildren autoload :HasContent + autoload :HasIntermediateFile autoload :HasMultiresImage autoload :HasStructMetadata autoload :HasThumbnail autoload :Indexing autoload :NotFoundError, 'ddr/models/error' autoload :PermanentId autoload :SolrDocument - autoload :StructDiv autoload :Structure autoload :WithContentFile autoload :YearFacet autoload_under "licenses" do @@ -76,19 +71,25 @@ autoload :License autoload :InheritedLicense autoload :ParentLicense end - # Base directory of default external file store - mattr_accessor :external_file_store + module Structures + extend ActiveSupport::Autoload - # Base directory of external file store for multires image derivatives - mattr_accessor :multires_image_external_file_store + autoload :Agent + autoload :Div + autoload :File + autoload :FileGrp + autoload :FileSec + autoload :FLocat + autoload :Fptr + autoload :MetsHdr + autoload :Mptr + autoload :StructMap + end - # Regexp for building external file subpath from hex digest - mattr_accessor :external_file_subpath_regexp - # Image server URL mattr_accessor :image_server_url mattr_accessor :permanent_id_target_url_base do "https://repository.duke.edu/id/" @@ -126,20 +127,19 @@ mattr_accessor :auto_update_permanent_id do false end + # File path to vips + mattr_accessor :vips_path + + mattr_accessor :default_mime_type do + "application/octet-stream" + end + # Yields an object with module configuration accessors def self.configure yield self - end - - def self.external_file_subpath_pattern= (pattern) - unless /^-{1,2}(\/-{1,2}){0,3}$/ =~ pattern - raise "Invalid external file subpath pattern: #{pattern}" - end - re = pattern.split("/").map { |x| "(\\h{#{x.length}})" }.join("") - self.external_file_subpath_regexp = Regexp.new("^#{re}") end end end