require 'ddr/models/engine' require 'ddr/models/version' require 'active_record' require 'active_fedora' require 'hydra/validations' module Ddr extend ActiveSupport::Autoload autoload :Actions autoload :Auth autoload :Datastreams autoload :Derivatives autoload :Events autoload :Index autoload :Jobs autoload :Managers autoload :Metadata autoload :Notifications autoload :Utils autoload :Vocab module Models extend ActiveSupport::Autoload autoload :AdminSet autoload :AttachedFileProfile autoload :AttachedFilesProfile autoload :AutoVersion autoload :Base autoload :ChecksumInvalid, 'ddr/models/error' autoload :Contact autoload :ContentModelError, 'ddr/models/error' autoload :DerivativeGenerationFailure, 'ddr/models/error' autoload :Error autoload :EventLoggable autoload :File autoload :FileCharacterization autoload :FileManagement autoload :FindingAid autoload :FixityCheckResults autoload :Governable autoload :HasAdminMetadata autoload :HasAttachments autoload :HasChildren autoload :HasContent autoload :HasMultiresImage autoload :HasStructMetadata autoload :HasThumbnail autoload :Indexing autoload :NotFoundError, 'ddr/models/error' autoload :Relation autoload :SolrDocument autoload :StructDiv autoload :Structure autoload :UrlSafeId autoload :Validatable autoload :Validator autoload :Versionable autoload :WithContentFile autoload :YearFacet autoload_under "files" do autoload :FitsXmlFile autoload :StructuralMetadataFile end autoload_under "licenses" do autoload :AdminPolicyLicense autoload :EffectiveLicense autoload :License autoload :InheritedLicense autoload :ParentLicense end autoload_under "metadata" do autoload :AdministrativeMetadata autoload :DescriptiveMetadata autoload :Metadata autoload :MetadataMapping autoload :MetadataTerm autoload :MetadataVocabulary autoload :MetadataVocabularies end autoload_under "search" do autoload :Catalog autoload :SearchBuilder end # Base directory of default external file store mattr_accessor :external_file_store # Base directory of external file store for multires image derivatives mattr_accessor :multires_image_external_file_store # Regexp for building external file subpath from hex digest mattr_accessor :external_file_subpath_regexp # Image server URL mattr_accessor :image_server_url # Whether permanent IDs should be automatically assigned on create mattr_accessor :auto_assign_permanent_ids mattr_accessor :permanent_id_target_url_base do "https://repository.lib.duke.edu/id/" end # Home directory for FITS mattr_accessor :fits_home # Run file characterization or not? mattr_accessor :characterize_files do false end class << self alias :characterize_files? :characterize_files end mattr_accessor :ead_xml_base_url do "http://library.duke.edu/rubenstein/findingaids/" end # Application temp dir - defaults to system temp dir mattr_accessor :tempdir do Dir.tmpdir 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 ActiveFedora::Predicates.set_predicates(Ddr::Metadata::PREDICATES) Dir[Ddr::Models::Engine.root.to_s + "/app/models/*.rb"].each { |m| require m }