diff --git a/app/services/hyrax/simple_schema_loader.rb b/app/services/hyrax/simple_schema_loader.rb index 7fb373e607..f87969e942 100644 --- a/app/services/hyrax/simple_schema_loader.rb +++ b/app/services/hyrax/simple_schema_loader.rb @@ -158,7 +158,7 @@ def config_paths(schema_name) end def config_search_paths - [Rails.root, Hyrax::Engine.root] + Hyrax.config.simple_schema_loader_config_search_paths end def metadata_files diff --git a/lib/hyrax/configuration.rb b/lib/hyrax/configuration.rb index c3f25099a9..470873b192 100644 --- a/lib/hyrax/configuration.rb +++ b/lib/hyrax/configuration.rb @@ -1154,6 +1154,24 @@ def visibility_map @visibility_map ||= Hyrax::VisibilityMap.instance end + attr_writer :simple_schema_loader_config_search_paths + # A configuration for modifying the SimpleSchemaLoader#config_search_paths + # which will allow gems to add their own metadata yaml files and easily keep + # them within the gem. + # + # @return [Array] + # @see Hyrax::SimpleSchemaLoader#config_search_paths + # @example + # Hyrax.config do |config| + # config.simple_schema_loader_config_search_paths.unshift(HykuKnapsack::Engine.root) + # end + # + # Hyrax.config.simple_schema_loader_config_search_paths + # => [#, #, #] + def simple_schema_loader_config_search_paths + @simple_schema_loader_config_search_paths ||= [Rails.root, Hyrax::Engine.root] + end + private # @param [Symbol, #to_s] model_name - symbol representing the model diff --git a/spec/lib/hyrax/configuration_spec.rb b/spec/lib/hyrax/configuration_spec.rb index b8591e3d95..525fe69814 100644 --- a/spec/lib/hyrax/configuration_spec.rb +++ b/spec/lib/hyrax/configuration_spec.rb @@ -115,6 +115,7 @@ it { is_expected.to respond_to(:range_for_number_of_results_to_display_per_page) } it { is_expected.to respond_to(:range_for_number_of_results_to_display_per_page=) } it { is_expected.to respond_to(:work_requires_files?) } + it { is_expected.to respond_to(:simple_schema_loader_config_search_paths) } describe "#registered_ingest_dirs" do it "provides the Rails tmp directory for temporary downloads for cloud files" do