Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration for config_search_paths #6885

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading