-
Notifications
You must be signed in to change notification settings - Fork 49
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
♻️ TO MAIN: Add handling for Knapsack theme overrides #2011
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prior to this commit, we were looking for themes yaml files relative to the directory of the spawning script. For Hyku that was always the `Rails.root` directory. However, when running specs in Knapsack, that directory was `Knapsack::Engine.root`. This unearthed a potential configuration issue; namely that we want Knapsack's to control what themes are available, meaning we don't want to require amending Hyku's themes. So, we introduce a mechanism for looking up files first in the Knapsack then in Hyku. I discovered this bug in the specs for knapsack (below is the *Error stack trace*) <details> <summary>Error stack trace</summary> ``` 2) Hyrax::Admin::AppearancesController with an administrator GET #show assigns the requested site as @site Failure/Error: get :show, params: {} Errno::ENOENT: No such file or directory @ rb_sysopen - config/home_themes.yml # /usr/local/bundle/gems/psych-3.3.4/lib/psych.rb:582:in `initialize' # /usr/local/bundle/gems/psych-3.3.4/lib/psych.rb:582:in `open' # /usr/local/bundle/gems/psych-3.3.4/lib/psych.rb:582:in `unsafe_load_file' # ./hyrax-webapp/app/controllers/hyrax/admin/appearances_controller.rb:19:in `show' # /usr/local/bundle/gems/rails-controller-testing-1.0.5/lib/rails/controller/testing/template_assertions.rb:62:in `process' # /usr/local/bundle/gems/devise-4.9.2/lib/devise/test/controller_helpers.rb:35:in `block in process' # /usr/local/bundle/gems/devise-4.9.2/lib/devise/test/controller_helpers.rb:104:in `catch' # /usr/local/bundle/gems/devise-4.9.2/lib/devise/test/controller_helpers.rb:104:in `_catch_warden' # /usr/local/bundle/gems/devise-4.9.2/lib/devise/test/controller_helpers.rb:35:in `process' # /usr/local/bundle/gems/rails-controller-testing-1.0.5/lib/rails/controller/testing/integration.rb:16:in `block (2 levels) in <module:Integration>' # ./spec/controllers/hyrax/hyrax/admin/appearances_controller_spec.rb:31:in `block (4 levels) in <top (required)>' # /usr/local/bundle/gems/webmock-3.19.1/lib/webmock/rspec.rb:39:in `block (2 levels) in <top (required)>' # ./hyrax-webapp/spec/support/multitenancy_metadata.rb:50:in `block (2 levels) in <top (required)>' # /usr/local/bundle/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:124:in `block in run' # /usr/local/bundle/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:110:in `loop' # /usr/local/bundle/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:110:in `run' # /usr/local/bundle/gems/rspec-retry-0.6.2/lib/rspec_ext/rspec_ext.rb:12:in `run_with_retry' # /usr/local/bundle/gems/rspec-retry-0.6.2/lib/rspec/retry.rb:37:in `block (2 levels) in setup' # ./spec/spec_helper.rb:10:in `block (2 levels) in <top (required)>' ``` </details> Related to: - #2007 - #2008 The above two commits will require some reconciliation once this is incorporated.
Given the existence of Knapsack we need to consider how overrides in Knapsack will take precedence over Hyku files. This change handles cases where we want to use the Knapsack's uploaded thumbnails. Related to: - #2010
This was referenced Oct 5, 2023
laritakr
requested changes
Oct 18, 2023
@@ -1,5 +1,5 @@ | |||
<% thumbnail_path = SolrDocument.find(@collection.id).thumbnail_path %> | |||
<% if thumbnail_path.include?("uploaded_collection_thumbnails") and File.exist? Rails.root.join("public#{::SolrDocument.find(@collection.id).thumbnail_path}") %> | |||
<% if thumbnail_path.include?("uploaded_collection_thumbnails") and File.exist? Hyky::Application.path_for("public#{::SolrDocument.find(@collection.id).thumbnail_path}") %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo here... needs to be Hyku:
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior to this commit, we were looking for themes yaml files relative to the directory of the spawning script. For Hyku that was always the
Rails.root
directory. However, when running specs in Knapsack, that directory wasKnapsack::Engine.root
.This unearthed a potential configuration issue; namely that we want Knapsack's to control what themes are available, meaning we don't want to require amending Hyku's themes.
So, we introduce a mechanism for looking up files first in the Knapsack then in Hyku.
I discovered this bug in the specs for knapsack (below is the Error stack trace)
Error stack trace
Related to:
The above two commits will require some reconciliation once this is incorporated.