Skip to content

Commit

Permalink
Merge pull request #6885 from samvera/configuration-for-simple-schema…
Browse files Browse the repository at this point in the history
…-loader-config-search-paths

Add configuration for config_search_paths
  • Loading branch information
dlpierce authored Aug 12, 2024
2 parents e4f8a06 + 4d61d48 commit 9d8d5f8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/services/hyrax/simple_schema_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions lib/hyrax/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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<Pathname>]
# @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
# => [#<Pathname:/app/samvera>, #<Pathname:/app/samvera/hyrax-webapp>, #<Pathname:/app/samvera/hyrax-webapp/gems/hyrax>]
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
Expand Down
1 change: 1 addition & 0 deletions spec/lib/hyrax/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9d8d5f8

Please sign in to comment.