diff --git a/.koppie/config/initializers/hyrax.rb b/.koppie/config/initializers/hyrax.rb index f99e224d4c..9128a4064d 100644 --- a/.koppie/config/initializers/hyrax.rb +++ b/.koppie/config/initializers/hyrax.rb @@ -317,23 +317,26 @@ Qa::Authorities::Local.register_subauthority('languages', 'Qa::Authorities::Local::TableBasedAuthority') Qa::Authorities::Local.register_subauthority('genres', 'Qa::Authorities::Local::TableBasedAuthority') -custom_queries = [Hyrax::CustomQueries::Navigators::CollectionMembers, - Hyrax::CustomQueries::Navigators::ChildCollectionsNavigator, - Hyrax::CustomQueries::Navigators::ParentCollectionsNavigator, - Hyrax::CustomQueries::Navigators::ChildFileSetsNavigator, - Hyrax::CustomQueries::Navigators::ChildWorksNavigator, - Hyrax::CustomQueries::Navigators::ParentWorkNavigator, - Hyrax::CustomQueries::Navigators::FindFiles, - Hyrax::CustomQueries::FindAccessControl, - Hyrax::CustomQueries::FindCollectionsByType, - Hyrax::CustomQueries::FindFileMetadata, - Hyrax::CustomQueries::FindIdsByModel, - Hyrax::CustomQueries::FindManyByAlternateIds, - Hyrax::CustomQueries::FindModelsByAccess, - Hyrax::CustomQueries::FindCountBy, - Hyrax::CustomQueries::FindByDateRange] -custom_queries.each do |handler| - Hyrax.query_service.custom_queries.register_query_handler(handler) +Rails.application.reloader.to_prepare do + custom_queries = [Hyrax::CustomQueries::Navigators::CollectionMembers, + Hyrax::CustomQueries::Navigators::ChildCollectionsNavigator, + Hyrax::CustomQueries::Navigators::ParentCollectionsNavigator, + Hyrax::CustomQueries::Navigators::ChildFileSetsNavigator, + Hyrax::CustomQueries::Navigators::ChildWorksNavigator, + Hyrax::CustomQueries::Navigators::ParentWorkNavigator, + Hyrax::CustomQueries::Navigators::FindFiles, + Hyrax::CustomQueries::FindAccessControl, + Hyrax::CustomQueries::FindCollectionsByType, + Hyrax::CustomQueries::FindFileMetadata, + Hyrax::CustomQueries::FindIdsByModel, + Hyrax::CustomQueries::FindManyByAlternateIds, + Hyrax::CustomQueries::FindModelsByAccess, + Hyrax::CustomQueries::FindCountBy, + Hyrax::CustomQueries::FindByDateRange] + custom_queries.each do |handler| + Hyrax.query_service.custom_queries.register_query_handler(handler) + end end + ActiveFedora.init(solr_config_path: Rails.root.join('config', 'solr.yml')) diff --git a/.koppie/config/initializers/riiif.rb b/.koppie/config/initializers/riiif.rb index e4835610ea..b635933bcc 100644 --- a/.koppie/config/initializers/riiif.rb +++ b/.koppie/config/initializers/riiif.rb @@ -35,32 +35,35 @@ module Hyrax # Adds file locking to Riiif::File # @see RiiifFileResolver - class RiiifFile < Riiif::File - include ActiveSupport::Benchmarkable - - attr_reader :id - def initialize(input_path, tempfile = nil, id:) - super(input_path, tempfile) - raise(ArgumentError, "must specify id") if id.blank? - @id = id - end + Rails.application.reloader.to_prepare do + class RiiifFile < Riiif::File + include ActiveSupport::Benchmarkable + + attr_reader :id + def initialize(input_path, tempfile = nil, id:) + super(input_path, tempfile) + raise(ArgumentError, "must specify id") if id.blank? + @id = id + end - # Wrap extract in a read lock and benchmark it - def extract(transformation, image_info = nil) - Riiif::Image.file_resolver.file_locks[id].with_read_lock do - benchmark "RiiifFile extracted #{path} with #{transformation.to_params}", level: :debug do - super + # Wrap extract in a read lock and benchmark it + def extract(transformation, image_info = nil) + Riiif::Image.file_resolver.file_locks[id].with_read_lock do + benchmark "RiiifFile extracted #{path} with #{transformation.to_params}", level: :debug do + super + end end end - end - private + private - def logger - Hyrax.logger + def logger + Hyrax.logger + end end end + class RiiifFileResolver include ActiveSupport::Benchmarkable diff --git a/app/services/hyrax/workflow.rb b/app/services/hyrax/workflow.rb new file mode 100644 index 0000000000..70ad3a4cc9 --- /dev/null +++ b/app/services/hyrax/workflow.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true +module Hyrax + module Workflow + extend ActiveSupport::Autoload + + autoload :WorkflowFactory + end +end diff --git a/config/initializers/listeners.rb b/config/initializers/listeners.rb index 7ff019f00f..33e140268c 100644 --- a/config/initializers/listeners.rb +++ b/config/initializers/listeners.rb @@ -2,8 +2,10 @@ Hyrax.publisher.subscribe(Hyrax::Listeners::ActiveFedoraACLIndexListener.new) unless Hyrax.config.disable_wings -Hyrax.publisher.default_listeners.each do |listener| - Hyrax.publisher.subscribe(listener) +Rails.application.reloader.to_prepare do + Hyrax.publisher.default_listeners.each do |listener| + Hyrax.publisher.subscribe(listener) + end end # Publish events from old style Hyrax::Callbacks to trigger the listeners diff --git a/lib/hyrax.rb b/lib/hyrax.rb index 4024b5a38d..e27d559a19 100644 --- a/lib/hyrax.rb +++ b/lib/hyrax.rb @@ -46,6 +46,11 @@ module Hyrax autoload :ResourceSync autoload :Zotero autoload :Listeners + autoload :Workflow + autoload :SimpleSchemaLoader + autoload :VirusScanner + autoload :DerivativeBucketedStorage + #autoload :CustomQueries end ##