Skip to content

Commit

Permalink
🎁 Hyrax 5 upgrade (#2047)
Browse files Browse the repository at this point in the history
* remove dogbiscuit crossover, fix routes

* add spec for search history

* add missing methods to avoid content block errors

* Update Hyku Gemfile.lock

* add option to support good job for background jobs instead of sidekiq

* update gemfile lock

* Update good_job.rb

* merge

* fix routes file, add missing js file

* 💄 styling fix

* 💄 rubocop fixes

* remove iiif_print/iiif_print require

cause of Sprockets::FileNotFound in Splash#index error. Doesn't seem necessary.

* 🎁 🧹 add missing file and format with semicolons

The previous build revealed that admin_color_select.js was missing. It also complained about missing semicolons.

* 💄 correct missing semicolons

appease the hound by formatting js file with semicolons.

* 🧹 remove call to iiif_print/iiif_print

Cause of build error. It's already being included in sass.

* 💄 Rubocop fixes

* ✅ Fix test setup for catalog_controller_spec

This commit will add additional setup to the catalog_controller_spec.

* Add knapsack helper

* remove Adventist from application.rb

* 🎁 Add conditional to run correct command for worker

This commit adds a conditional to run the correct command for sidekiq or good_job, when running docker compose up.

* Make appearance constants overrideable

This allows for the knapsack to override the constants by defining and
using a method rather than a constant in the look-ups.

* add reporting fix to hyku ci

* spec loading fixes

* rubocop

* 🧹Make appearance defaults overrideable

* bump bulkrax to 5.4.0

This commit pulls in a small collection of bug fixes.

* 🧹 Include knapsack css

* fix job loading when selecting good job

* adjust docker compose to use the startup script

* 🎁 install tesseract eng_best

* ♻️ revert tesseract best changes to dockerfile

this change belongs in the knapsack directory instead

* ♻️ revert tesseract best changes to dockerfile

this change belongs in the knapsack directory instead

* 🐛 Bring fix for entry show page not showing link

This commit will bring in a fix from Bulkrax that correctly shows the
object from the entry show page.

ref:
  - samvera/bulkrax@0e68a5e

* 🧹 Revert previous commit and update Bulkrax

This commit will update Bulkrax to 5.4.1 instead of using the override
from the last commit.  We also revert the changes from the last commit.

* 🐛 subject can't be blank for the contact form

Previously there was a bug because even if you typed in a subject, the contact form would error saying that it was blank.

Part of issue:
- https://github.com/scientist-softserv/adventist-dl/issues/608

* mend

* ♻️ Add handling for Knapsack theme overrides

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.

* ♻️ Favor Hyku::Application.path_for over Rails.root

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

* 🎁 Add highlight key to UV

This commit allows for the `parent_query` to be highlighted in the UV so
users won't have to do a catalog search and also a UV search.

* 🐛 Mixin `HykuKnapsack::ApplicationHelper`

This commit will mixin the `HykuKnapsack::ApplicationHelper` into the
ApplicationHelper which will allow us to use #render_ocr_snippets for
snippet highlighting.

* Revert "🐛 Mixin `HykuKnapsack::ApplicationHelper`"

This reverts commit ae093f1.

* ♻️ Favor class_attribute over constant

In Adventist, we're needing to override the constant's values.  By
making this a class_attribute we can more readily do the override via
configuration instead of obliteration of a constant.

* ♻️ Favor configurable html head title value

Prior to this commit, we hard-coded the page title; this is something
that should be far more configurable.  And this refactor is a step
towards that.

This also allows for downstream implementors to not have to override the
view simply to change the title element.

* 🐛 Add custom rendering for license

Prior to this commit, the License would render as a plain URL.  With
this change, we are now coercing the license into a URL that is labeled
and titled with the name of the license.

This is copied and modified based on [Rights show partial][1]

Related to:

- https://github.com/scientist-softserv/adventist-dl/issues/620

[1]: https://github.com/samvera/hyrax/blob/b334e186e77691d7da8ed59ff27f091be1c2a700/app/views/records/show_fields/_rights.html.erb

* ♻️ Add option to override devise configuration

For Adventist, we wanted to disable registration of accounts as this was
creating a case where folks were creating their own accounts and
tenants.

Related to:

- https://github.com/scientist-softserv/adventist-dl/issues/492
- https://github.com/scientist-softserv/adventist-dl/issues/618
- #1964
- scientist-softserv/adventist-dl#493

* run asset build later in process to allow knapsack to run it only one time

* 🐛 Fix Add to Collection for page 2+ of works

Prior to this commit, when you were on page 2 of your works and selected
a work to add to a collection, the query for available collections would
use the page 2 as part of the collection query.  This would mean the
first 100 collections (default page size) that you had access to add
works to were skipped.

With this commit, we omit the query parameters from the works page and
then query collections.

Related to:

- samvera/hyrax#5972
- samvera/hyrax#5969
- https://github.com/scientist-softserv/adventist-dl/issues/625

Co-authored-by: LaRita Robinson <[email protected]>

* test that invited users are added to the registered group

* Add invited users to the registered group

Fixes a bug where users who were invited with no roles would not
show up in the users list at all

* 🐛 Change Hyky to Hyku (#2029)

Typo caused inability to upload collection thumbnail.

* 🎁 Modify labels in UV for V3 manifests

This commit will add the same treatment as we have for V2 manifests to
V3 manifests. This will allow the UV to add a more human readable label
to the pages.

Ref:
  - https://github.com/scientist-softserv/adventist-dl/issues/628

* 🐛 Fix bad method name

Related to:

- https://github.com/samvera/hyku/pull/2023/files
- scientist-softserv/atla-hyku#198

* 🐛 Move some methods to be public

This commit will move #solr_document, #current_ability, and #request to
be public methods.  Since these methods in Hyrax were not private, in
the decorator it should not be private either.

Ref:
  - https://github.com/samvera/hyrax/blob/b334e186e77691d7da8ed59ff27f091be1c2a700/app/presenters/hyrax/file_set_presenter.rb#L10

* First attempt for upgrade to Hyrax 5.0.0.rc2

So far the changes throw an error `The adapter `nulldb_adapter` is not
yet supported` when doing a `docker compose build`.  Commenting out `RUN
RAILS_ENV=production SECRET_KEY_BASE=`bin/rake secret` DB_ADAPTER=nulldb
DB_URL='postgresql://fake' bundle exec rake assets:precompile && yarn
install` in the Dockerfile allows the build to complete but still can't
boot yet.

* 🧹 Get assets to precompile

This commit has a lot in it, but of note:

- We forked apartment gem to expand activerecord version support
- Used the Hyrax upgrade guide to update assets
- Replaced bootstrap 3 variables with hard coded values
- Commented out blacklight_helper_behavior.rb because Blacklight 7
  removed it, we'll have to figure out how to get the same functionality
  in the new version

* 🧹 Switch to Hyrax `double_combo` branch

We are using this branch on Hyrax because it has quite a few Valkyrie
related fixes in it.

* 🧹 use class attribute instead of constant to correct failing specs

* Fix specs

* 🧹 Get the page to load

This commit will get the proprietor page to load.  You can create a
tenant and vist it as well.

* ♻️ Introduce Hyku::Application.theme_view_path_roots

With the introduction of [HykuKnapsack][1], we are adjusting how we
create instances of Hyku.  Namely we don't clone Hyku but instead we
incorporate Hyku as a submodule into a Knapsack.

The Knapsack is a Rails engine that is mounted in the Hyku application.
What this means is that when we want to

Prior to this commit, the only way to adjust themed views would have
been to add them to the Rails application (e.g. Hyku) directly.  Which
would work in a non-Knapsack ecosystem.

However, with Knapsack we need a means of saying "Hey, for themes we
want to be able to add/adjust views within the knapsack."  Hence this
change.

[1]: https://github.com/samvera-labs/hyku_knapsack

* 🧹 Prepping for rubocop

This commit will change the Docker image to rc1 because rc2 stopped
working (at least locally).  Also getting things ready to run rubocop.

* 🧹 Ran `bundle exec rubocop -a`

* 🧹 Autocorrect frozen string literals

```sh
rubocop --only Style/FrozenStringLiteralComment -A
```

* 🧹 Rubocop'd lengths and other low hanging fruit

Various length metrics were disabled in this commit.  Also other various
cops that were easy to fix.

* 🧹 Remove deprecated Blacklight code

removing the deprecated blacklight code allows the specs to run. We should consider if finding a replacement is necessary in the following ticket:

- scientist-softserv/hykuup_knapsack#54

Issue:
- scientist-softserv/hykuup_knapsack#35

* 🧹 Avoid `#present?` in non-Rails situations

Rails provides [`Object#present?`][1], which is a method that is not
generally available in Ruby.  However in the changed context, the
scripts do not have access to Rails methods.

By using this adjusted approach we favor baseline Ruby methods.

[1]: https://api.rubyonrails.org/classes/Object.html#method-i-present-3F

* 🧹 Get Homepage Controller specs passing (#2058)

Refactor homepage controller to more closely align with Hyrax's
homepage controller.
Adjust theme views to render `modal` instead of `ajax_modal`.

refs: scientist-softserv/hykuup_knapsack#56

* ♻️ Replace Homepage Presenter with decorator (#2059)

* 🧹Get CatalogController specs working (#2060)

* 🧹 Hyrax 5 get additional specs passing (#2062)

* 🧹 Get chrome.hyku.test working

* 🧹 Get SitesControllerSpecs working

 File fixtures were broken.
 Ref scientist-softserv/hykuup_knapsack#56

* 🧹 Remove google analytics from config reload

This is a piece of a fix for analytics that came in via
scientist-softserv/palni-palci#946

Additional backporting of analytics work is still needed, but this
fixes numerous specs so it is being pulled in earlier.

* 🧹 Update ruby version for circleci

* 🧹 Update rails version for circleci

* 🧹Database migration & schema update (#2063)

For table hyrax_counter_metrics

* 🧹 Fix Hyrax 5 remaining controller spec failures (#2064)

* 🧹Remove ActiveFedora monkeypatch

* 🧹Fix file fixture

* 🧹 Upgrade views from Bootstrap 3 to 4

This commit is a first swing of upgrading all the views from Bootstrap 3
to 4.  There's still a lot of work to be done to make the views look
good but this is a good first step.

* Hyrax 5 upgrade rubocop fixes & get specs running in CI (#2065)

* 🧹Rubocop Fixes

* Attempt to fix circleci

* 🧹 Fix CollapsableSectionPresenter override

The override was causing issues not passing the nav-link class into the
anchor tags.  This fix specifically passes the title attribute in vs the
previous implementation of trying to pass all html options in.

* 🧹 Remove required translations from locales

This commit will remove the override for the `required` translations
since it changed to a badge badge-style in Bootstrap 4.  This is
accounted for in Hyrax so we can fall back to that.

* 🐛 Fix some javascript errors

This commit will fix a few javascript errors, at least enough to get the
the bootstrap javascript to work correctly.  We're still getting a the
almond-rails js error but that seems to exist in previous Hyku as well.

* Hyrax 5 upgrade rubocop fixes & get specs running in CI (#2065)

* 🧹Rubocop Fixes

* Attempt to fix circleci

* 🧹 Post review adjustments

These are adjustments made after the PR has been reviewed.

* 🧹 Clean up a couple blacklight views

This commit will account for the new versions of Blacklight and
Blacklight Gallery.  The masonry view no longer exists so we can't tell
how it's broken as of right now.  I'm sure we'll run into it during our
testing.

NOTE:  These changes refer to the shared search tenant.

* 🧹 Bring back `BlacklightHelperBehavior`

This commit will bring back the `BlacklightHelperBehavior` module but it
will be namespaced under `Hyku` to avoid conflicts.  We will then
include it in the `HyraxHelper` module so those methods should override
the ones in `Blacklight::BlacklightHelperBehavior`.

* 🧹 Hyrax 5 upgrade additional specs (#2067)

* 🧹 More spec & controller fixes

 Ref scientist-softserv/hykuup_knapsack#55

 - Contact form controller and pages controller duplicate some of the
 homepage controller behavior, so corresponding fixes are needed.
 - Update collections factory and collection_ability_spec to match hyrax
 and stop calling `.gid` on a collection_type.
 - Adjust permission_template_form_spec to adjust for removal of method
 `reset_access_controls!` and add a few new expectations instead.

* 🧹 Begin work on Roles Service

Working with Permission Templates has changed, requiring an adjustment
to both logic and specs.

* 🧹 Solr Document Ability Spec

* Rubocop fixes

* Fix typo of collection variable

* Reinstate some collections factory overrides

* Revert Rubocop changes

Caused spec failure in roles_service_spec.

* Fix create_default_admin_set_job_spec

* Restore mistakenly removed capta use

* 🧹 Stanford import specs

We have plans to remove the Stanford import logic, but for now, this
handles the specs that were failing, in an attempt to get CI to pass.

* Make Rubocop happy

* Fix typo

* Update Hyrax to pull in most recent changes

* More spec fixes

Menu presenter: removed html_options
Application Helper: override for missing_translations now receives
`false` when translation wasn't found rather than a string.

* Fix missing translation logic

* Fix  missing_translation override

Simplify and fix override. A missing translation now returns `false`
instead of the text `translation missing`.

The super method requires the `option` parameter, so we opted to keep
the override.

* 🧹 Remove copied code

The overrides are no longer necessary.  In reviewing the diff between
what I'm removing and what is in the `double_combo` branch; the major
change was adding an operator for the `reduce` function.  The breaking
problem was that the method signature of one of the copied methods has
changed in Hyrax 5.0.

The removal considers that Hyrax::Group is of two different classes:

- In Hyrax, it is a plain old Ruby object
- In Hyku, it is descended from ActiveRecord::Base

The two classes have different instantiation parameters.  Hence the
introduction of `Hyrax::Group.new` in this code.

* 🧹 Fix missing method name

* 🐛 Ensure :maxFileSize is integer

Prior to this commit, we were casting the value to string.  However
Hyrax attempts to do division on that string.

See https://github.com/samvera/hyrax/blob/b7891b758411c59f71ff54212e0d250fcc47e35f/app/views/hyrax/base/_form_files.html.erb#L6-L15

* Skip taking a picture on failure

* 🧹 Fix issue regarding Valkyrie::Identifier

The encountered error was:

```
NoMethodError:
  undefined method `split' for #<Valkyrie::ID:0x0000ffffa5f04bc8
  @id="admin_set/default">
```

* 🧹 Favor Sipity::Entity function over to_sipity_entity

The Sipity conversion methods are now explicit functions (much like the
`Array()` function).

- https://github.com/samvera/hyrax/blob/5aaa568d348a180add2a1337d9d794b740703df8/app/models/sipity.rb#L20

* Update Hyrax IIIF AV gem

* 🧹 Review controller overrides

Many of the controllers just needed to be updated with the decorator
pattern.  We're creating a new concern for all the Hyku specific
overrides in Hyku::WorksControllerBehavior.  This has to be included in
the Controller classes after Hyrax::WorksControllerBehavior to override
the relevant methods.

* clean up from pr review

* Appease rubocop

* Update IIIF Print gem

* 🤖 Specify Cache Root

Prior to this commit, we were seeing the following failure:

> Failure/Error: Site.application\_name || super
>
> ActionView::Template::Error:
>  Permission denied @ dir\_s\_mkdir - /app

The `Account#setup_tenant_cache` sets the cache\_store to be
`ENV.fetch('HYKU_CACHE_ROOT', '/app/samvera/file_cache')`.  When I
locally chanced it to `/blorg/samvera/file_cache` I could repeat the
error.

With this commit, we're setting the cache value for the CircleCI run.

Why was it previously working?  Perhaps because
`Account#setup_tenant_cache` never got called due to other
configurations?  There is a guard clause around the method call.

* 🧹 Update spec to reflect AdminSet default behavior

In the following commit, we removed the deprecated
`AdminSet.find_or_create_default_admin_set_id`:

- samvera/hyrax@863c4bc

This commit follows the advice of the deprecation warning and now favors
the `Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id`
method call.

Related to:

- samvera/hyrax#6203

* Remove obsolete site roles and routes (#2080)

The site/roles route is obsolete. This is an attempt to remove as much
of the obsolete logic as possible, as it has been replaced by the groups
with roles feature.

* Remove stanford importer

Importer was deprecated in prior release version.

* 🤖 Fix spec/features/collection_type_spec.rb

There are three major changes:

1. Favor setting `collection_type` attribute instead of
   `collection_type_gid`
2. Change `#collections?` to `#collections#any?`
3. Change CSS selector based on Bootstrap upgrade

The above changes are related to work done in:

- samvera/hyrax#5730
- samvera/hyrax#5742
- samvera/hyrax#4701

See:
- samvera/hyrax@eb6e04e
- samvera/hyrax@237c0c6
- samvera/hyrax@280664b

* 🤖 Fix stub methods to pass tests

These tests weren't verifying that we could reach Redis; they were
testing the interface of the `RedisEndpoint#ping` by mocking the
instance.

This commit changes the mocking by avoiding a call to
`Hyrax::RedisEventStore.instance` which was raising a Redis connection
error.

Again, this test is not is redis connecting but "assume we are trying to
connect to redis now demonstrate ping."

* Lock chromedriver version (#2086)

Refs
CircleCI-Public/browser-tools-orb#96
CircleCI-Public/browser-tools-orb#75 (comment)

* 🧹 Clean up model overrides

Most of what's in this commit is just updating the Hyrax version in the
override comments.  There was also an opportunity to switch the
`ContactForm` model to a decorator.

* 🤖 Favor general spec over specific

With the CircleCI alternate place for the file_store cache, we need to
fallback to a more general test assertion.

* 🤖 Bring over Hyrax spec changes

* 🤖 Extract constant to ease testing

We're not concerned with where the cached file is for testing purposes;
so instead of hard-coding a value that can change in the ENV, let's
compare the constant that we use in the code.

tl;dr - Don't rely on magic strings

* 🤖 Re-arrange CleanupAccountJob specs

The `CleanupAccountJob` was stubbing very nosily; needing to know too
much about implementation details of the end-points.  Instead this
preserves the over-view spec (e.g. what all the cleanup spec actually
cleans up) while moving that nosy logic to the constituent endpoint.

Most of these specs are testing that the method chains work; which is
perhaps adequate as the other option is far more expensive tests (e.g.
make a new Fedora node only to then immediately destroy it)

I'm also leveraging the new `Redis::Namespace#clear` method.

Related to:

- resque/redis-namespace#202

* 🧹 Restore btn-sign-up on splash page

This change was part of the bulk upgrade of Bootstrap 3 to 4.

* 🧹 Fix `./spec/requests/admin_dashboard_spec.rb` spec

Prior to this commit, the specs failed because of the introduction of
the WorkflowResponsibilityFormDecorator.  The decorator extracted prior
logic from Hyrax::Admin::WorkflowRolesController.

In copying that logic we introduced a subtle bug.  Namely, we favored
the original `.new` behavior if and only if you provided a `:user_id`.
This broke places where we instantiated the form in a
view (e.g. `./app/views/hyrax/admin/workflow_roles/index.html.erb`).

With this change, we make the behavior of `.new` fail towards its
"normal" implementation and instead rely on the presence of an attribute
to switch to a different form instantatior.

See Commit:

- 095edca

Related to:

- #2079

Co-authored-by: LaRita Robinson <[email protected]>
Co-authored-by: Kirk Wang <[email protected]>

* 🎁 Upgrade Redis initializer to Hyrax 5's gen version

Prior to this commit, when looking at the
`Hyrax::RedisEventStore.instance` we saw it's connection information as:

`#<Redis client v4.8.1 for redis://localhost:6379/0>`

We were expecting the connection to be the following:

`#<Redis client v4.8.1 for redis://redis:6379/0>`

What we were seeing in tests is when we hit the redis connection we were
getting an error about not being able to connect to 127.0.0.1:6379 (e.g.
localhost).

With this commit, we have a clear connection to Redis.

See Redis Config initializer:

- https://github.com/samvera/hyrax/blob/966951ffaa72524e4a775f8a198bd51a47ece7d9/lib/generators/hyrax/templates/config/initializers/redis_config.rb#L1-L10

Co-authored-by: Kirk Wang <[email protected]>

* 🧹 Clean up actors

Just found one actor that was overriding Hyrax.  This commit will switch
it to a decorator.

* 🐛 Handle missing labels

Adjust paths and keys to look for labels.

* Appease the cops

* 🧹 Assigning collection_type

The partials rendered in the tested view assume that we've set a
collection type.

* Appease rubocop

* Fixing nav link selectors to new structure

* Fixing nav link selectors to new structure

* 🧹 Clean up forms

The only big thing in this commit is the appearance_decorator.  I've
added to the spec to show that the decorator should be working as
intended.

* 🧹 Fix spec based on HTML class changes

* 🧹 Narrow specificity of CSS selector

The selector was *very* specific, and with the HTML class changes for
Bootstrap 3 to 4, this almost certainly broke.

Note, there are still underlying issues with two other specs; there
errors are listed below:

```
1) Admin can select home page theme when a search results theme is
selected updates the search results page with the selected layout view

Failure/Error: super

     ActionView::Template::Error:
       undefined method `with_collection' for nil:NilClass
```

* 🧹 Remove specificity of CSS selectors in test

The hyper specific selectors are not durable for CSS framework upgrades.

* 🐛 Adding document_component to blacklight's config

Blacklight 7.35.0 's default document_component is `nil`, see:

- https://github.com/projectblacklight/blacklight/blob/ac5fa8b300c5ad5c35b1663ef0f15372ffa2be0f/lib/blacklight/configuration.rb#L213
- https://github.com/projectblacklight/blacklight/blob/ac5fa8b300c5ad5c35b1663ef0f15372ffa2be0f/lib/blacklight/configuration.rb#L186

 Digging around in the wiki, you might find (only found because I cloned the repo):

- https://github.com/projectblacklight/blacklight/wiki/Configuration---Results-View

Related to:

- projectblacklight/blacklight#2317

* 🧹 Allow :clean or :clean_repo to work for the cleaners

Hyrax has :clean_repo and Hyku has :clean

Sometimes folks copy over specs from Hyrax, and bring along the
:clean_repo; which looks like it should work.

With this commit, we bring that logic along!

* 🧹 Remove skip CI

Perhaps it's flappy; but let's see.

* 🧹 Fix button class for Bootstrap 3 to 4

* 🧹 Favor Layout/LineLength over Metrics/LineLength

Rubocop seams to prefer the Layout namespace for LineLength.

* 🧹 The selector is not working

Checking the HTML (on the CircleCI SSH environment), it appears that the
selector should work in test.  But it is not.  So I'm removing the specificity.

* Cleaning a spec that should start clean

* 🧹 Ensure feature specs run clean

Prior to this commit, we did not automatically clean the features.  The
below ripgrep (and output) shows that there were some features which did
not start from a clean state.

```
rg "(clean|clean_repo):" spec/features --files-without-match
``

```
spec/features/accounts_spec.rb
spec/features/proprietor_spec.rb
spec/features/featured_collections_spec.rb
spec/features/user_roles_spec.rb
spec/features/oai_pmh_spec.rb
```

* Stab at trying to find a problem

* 🧹 Clean up services

This commit will reconcile the services that are overrides for Hyrax
with the Hyrax 5.0.0rc2 version.  There were a number of overrides that
were changed to the decorator pattern.

* Moving rescue and documenting the why

* 🧹 Rearrange order of filter chain

This is not tested in the UI, but the
`show_works_or_works_that_contain_files` remains after the troublesome
advanced query filters.

* 🧹 Address PR comments

This commit addresses comments from the review but one thing that is of
note is loading the I18n translations in the application.rb file.  We
needed this because our decorators load prior to I18n loads the locales
in our config/locales directory for them to use so we were getting
missing translations.

* 🧹 Attempting to find and squash bug

* ♻️ Account for observed customizations

Dear reviewer, put on your reading glasses.

This commit looks at the newly refactored
`Hyrax::IiifAv::DisplaysContentDecorator` as well as the current state
of [PALS's Hyrax::IiifAv::DisplaysContentDecorator][1] and attempts to
account for the variances between the two by introducing configurations.

Yes, we could port this to the hyrax-iiif_av gem, but for now that would
not solve the underlying issue of how we've been handling things.

Why the Hyku::Application class attribute?  Because the decorator is
being mixed into a module, which does not response to `.class_attribute`
methods.

[1]: https://github.com/scientist-softserv/palni-palci/blob/8754556c0225ce9f04674c1ffac6403586fd65f4/app/presenters/concerns/hyrax/iiif_av/displays_content_decorator.rb

* 🧹 Clean up other overrides

This commit is aiming to clean up the rest of the found overrides.

* 🧹 Change locale file load order so that our local files are prioritized

We add our local config locale directory to the I18n.load_path so that our local files take precendence over the ones found in our gems.

Related issue:
- scientist-softserv/hykuup_knapsack#55

* 🧹 Update IIIF Print and AV gems

We were not seeing images loading correctly in the UV because we
introduced the `Hyku::WorksControllerBehavior` and IIIF Print did not
know about it.
  - scientist-softserv/iiif_print@cad2cf3

We were seeing a respon to mismatch error in the Hyrax IIIF AV.
  - samvera-labs/hyrax-iiif_av@4723b8f

Also, the image that I tested was a phone image that apparently had
different ExifImageHeight/ExifImageWidth values than the
ImageHeight/ImageWidth values.  This was probably because modern phones
typically generate multiple images so the user can choose the best shot.
The exiftool_image_to_fits.xslt was proritizing the Exif values over the
regular values and would cause our image characterization to have weird
height and width values.  The change in this PR prioritizes the regular
over the Exif values.

Ref:
  - scientist-softserv/hykuup_knapsack#68

* 🐛 Fix video thumbnail generation

In a previous commit we created the
`Hyrax::FileSetDerivativesServiceDecorator` to override the default
thumbnails that Hyrax uses but I forgot to add the video thumbnail,
which is fixed here.

Ref
  - scientist-softserv/hykuup_knapsack#69

* 🧹 Add space between thumbnail and title

* 🧹 Update Hyku version

This commit bumps the hyku version from 5.1.0 to 6.0.0.

* 💄 ruboco fix

* 🧹 Fixing a few styles

This commit will change the maximized size to match Bootstrap 4 break
points.  Also, added btn-secondary to hyku.css so it doesn't get
overriden by appearance styles.  Finally, restructured the homepage to
make it look more like Hyrax 5.

* sort properties

* adjust screen size

* 🧹 Update `rails` to `6-1-stable` for GoodJob

There is a compatibility issue with Rails 6.1.7.6 and Ruby 3.2 that was
affecting GoodJob.  There was a backport to the 6-1-stable branch that
fixes this issue.

See:
  - rails/rails#46895

Ref:
  - scientist-softserv/hykuup_knapsack#67

* 🎁 only add Good Job classes if it's enabled

ref:
- #2047 (comment)

* ♻️ Removing file in favor of comments found in docker-compose.yml

Remove file in favor of comments found on lines #138 - 139, which uses the sleep infinity command to accomplish the same thing.

ref:
- https://devopscube.com/keep-docker-container-running/

* 🧹 Remove disabling of Rubocop Naming/PredicateName (#2126)

This cop was originally disabled in order to get specs to run during CI
without code changes. Now that specs are running, the changes can be
safely made to appease rubocop rather than disabling it.

* 🎁 Add Hyrax version in the footer

Often we forget what version of Hyrax we're running so this should help.

---------

Co-authored-by: Rob Kaufman <[email protected]>
Co-authored-by: Shana Moore <[email protected]>
Co-authored-by: LaRita Robinson <[email protected]>
Co-authored-by: Jeremy Friesen <[email protected]>
Co-authored-by: Benjamin Kiah Stroud <[email protected]>
Co-authored-by: LaRita Robinson <[email protected]>
  • Loading branch information
7 people authored Jan 5, 2024
1 parent 2f23cc7 commit 17c9192
Show file tree
Hide file tree
Showing 527 changed files with 7,313 additions and 10,452 deletions.
15 changes: 9 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2.1
orbs:
samvera: samvera/circleci-orb@1
browser-tools: circleci/browser-tools@1.3
browser-tools: circleci/browser-tools@1.4.6
ruby: circleci/ruby@2
node: circleci/node@5

Expand All @@ -10,13 +10,13 @@ jobs:
parameters:
ruby_version:
type: string
default: 2.7.8
default: 3.2.2
bundler_version:
type: string
default: 2.4.8
rails_version:
type: string
default: '5.1.6'
default: '6.1.7.6'
solr_config_path:
type: string
fcrepo_version:
Expand Down Expand Up @@ -61,6 +61,7 @@ jobs:
BUNDLE_PATH: vendor/bundle
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
HYKU_CACHE_ROOT: /tmp/hyku-cache
HYKU_RESTRICT_CREATE_AND_DESTROY_PERMISSIONS: 'true'
SOLR_ADMIN_USER: admin
SOLR_ADMIN_PASSWORD: admin
Expand All @@ -79,7 +80,9 @@ jobs:
ruby_version: << parameters.ruby_version >>
bundler_version: << parameters.bundler_version >>
- samvera/rubocop
- browser-tools/install-chrome
- browser-tools/install-chrome:
chrome-version: 114.0.5735.90 # see https://github.com/CircleCI-Public/browser-tools-orb/pull/96
replace-existing: true
- browser-tools/install-chromedriver
- run:
name: Check Chrome install
Expand All @@ -95,6 +98,6 @@ workflows:
ci:
jobs:
- bundle:
ruby_version: "2.7.8"
name: "ruby2-7-8"
ruby_version: "3.2.2"
name: "ruby3-2-2"
solr_config_path: 'solr/conf'
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
./coverage
./docker
./fcrepo
./importer
./log
./pg
./public/assets
Expand Down
11 changes: 7 additions & 4 deletions .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CHROME_HOSTNAME=chrome
COMPOSE_DOCKER_CLI_BUILD=1
DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL=true
DB_ADAPTER=postgresql
DB_HOST=db
DB_HOST=db
Expand All @@ -13,25 +14,27 @@ FCREPO_BASE_PATH=/hykudemo
FCREPO_HOST=fcrepo
FCREPO_PORT=8080
FCREPO_REST_PATH=rest
HYRAX_ACTIVE_JOB_QUEUE=sidekiq
HYRAX_FITS_PATH=/app/fits/fits.sh
INITIAL_ADMIN_EMAIL=[email protected]
INITIAL_ADMIN_PASSWORD=testing123
JAVA_OPTS=-Xmx4g -Xms1g
IN_DOCKER=true
JAVA_OPTS=-Xmx4g -Xms1g
LD_LIBRARY_PATH=/opt/fits/tools/mediainfo/linux
NEGATIVE_CAPTCHA_SECRET=default-value-change-me
PASSENGER_APP_ENV=development
RAILS_LOG_TO_STDOUT=true
REDIS_HOST=redis
SECRET_KEY_BASE=asdf
HYRAX_ACTIVE_JOB_QUEUE=sidekiq
HYRAX_FITS_PATH=/app/fits/fits.sh
NEGATIVE_CAPTCHA_SECRET=default-value-change-me
SOLR_ADMIN_PASSWORD=SolrRocks
SOLR_ADMIN_USER=solr
SOLR_COLLECTION_NAME=hydra-development
SOLR_CONFIGSET_NAME=hyku
SOLR_HOST=solr
SOLR_PORT=8983
SOLR_URL=http://solr:SolrRocks@solr:8983/solr/
TB_RSPEC_FORMATTER=progress
TB_RSPEC_OPTIONS="--format RspecJunitFormatter --out rspec.xml"

# Comment out these 5 for single tenancy / Uncomment for multi
HYKU_ADMIN_HOST=hyku.test
Expand Down
180 changes: 99 additions & 81 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,129 +1,147 @@
# Turn on RSpec cops
require: rubocop-rspec
inherit_from: .rubocop_todo.yml
inherit_from:
- .rubocop_fixme.yml

# With the rubocop 0.47.0 and rubocop-rspec 1.8.0 the following stderr message was sent:
# An error occurred while RSpec/DescribedClass cop was inspecting path/to/file
RSpec/DescribedClass:
Enabled: false
inherit_gem:
bixby: bixby_default.yml

AllCops:
NewCops: disable
TargetRubyVersion: 3.2.2
DisplayCopNames: true
TargetRubyVersion: 2.3
Exclude:
- 'bin/**/*'
- 'db/**/*'
- 'config/**/*'
- 'vendor/**/*'
- '.internal_test_app/**/*'
- 'spec/fixtures/**/*'
- 'spec/internal/**/*'
- 'script/**/*'
- 'spec/test_app_templates/**/*'
- 'Rakefile'
- 'lib/tasks/rubocop.rake'
# disabling collections controller as most of the rubocop errors are in hyrax
- 'app/controllers/hyrax/dashboard/collections_controller.rb'

Rails:
Enabled: true
- 'vendor/**/*'
- 'lib/hyrax/specs/**/*'
- 'bin/graph'
- 'bin/import_from_purl'

Rails/DynamicFindBy:
Whitelist:
- find_by_user_key
Lint/ImplicitStringConcatenation:
Exclude:
- 'lib/importer/factory/object_factory.rb'
- 'lib/generators/hyrax/**/*'

Rails/UnknownEnv:
Environments:
- development
- production
- staging
- test
Rails/Output:
Exclude:
- 'lib/generators/**/*'

Metrics/LineLength:
Max: 120
Metrics/BlockLength:
IgnoredMethods: ['included']
Exclude:
- 'app/controllers/catalog_controller.rb'
- 'spec/controllers/curation_concerns/generic_works_controller_spec.rb'
- 'spec/services/iiif_collection_thumbnail_path_service_spec.rb'
- 'spec/services/iiif_work_thumbnail_path_service_spec.rb'
- 'spec/routing/proprietor/accounts_routing_spec.rb'
- 'hyrax.gemspec'
- 'app/models/concerns/hyrax/content_block_behavior.rb'
- 'app/services/hyrax/workflow/workflow_schema.rb'
- 'config/initializers/simple_form.rb'
- 'config/features.rb'
- 'config/routes.rb'
- 'lib/generators/hyrax/templates/catalog_controller.rb'
- 'lib/generators/hyrax/templates/config/initializers/simple_form_bootstrap.rb'
- 'lib/hyrax/rails/routes.rb'
- 'lib/tasks/*.rake'
- 'spec/**/*.rb'
- 'tasks/benchmark.rake'

Layout/IndentationConsistency:
EnforcedStyle: rails
Style/AsciiComments:
Enabled: false

Layout/DotPosition:
EnforcedStyle: leading
# rubocop suggests !thing.nil? instead, but that is NOT equivalent
Style/DoubleNegation:
Enabled: false

Style/Documentation:
Style/CollectionMethods:
PreferredMethods:
collect: 'map'
collect!: 'map!'
inject: 'reduce'
detect: 'find'
find_all: 'select'

Style/SymbolArray:
Enabled: false

Style/StringLiterals:
Style/ClassAndModuleChildren:
Enabled: false

Style/WordArray:
Style/SingleLineBlockParams:
Enabled: false

Metrics/ClassLength:
Exclude:
- 'app/controllers/catalog_controller.rb'
Rails/ApplicationJob:
Enabled: false

Rails/ApplicationMailer:
Enabled: false

Metrics/ModuleLength:
Max: 200
Rails/ApplicationRecord:
Enabled: false

Rails/HasAndBelongsToMany:
Exclude:
- 'app/models/role.rb'

RSpec/AnyInstance:
Rails/HasManyOrHasOneDependent:
Exclude:
- 'app/models/endpoint.rb'

Rails/RakeEnvironment:
Enabled: false

RSpec/InstanceVariable:
# We define custom methods like `find_by_user_key`,
# `find_by_created_date`, etc
Rails/DynamicFindBy:
Enabled: false

Rails/FilePath:
Exclude:
- 'spec/controllers/hyku/registrations_controller_spec.rb'
- 'spec/abilities/**/*'

RSpec/NamedSubject:
Enabled: false
Rails/OutputSafety:
Exclude:
- 'app/builders/hyrax/form_builder.rb'
- 'app/helpers/hyrax/citations_behaviors/formatters/apa_formatter.rb'
- 'app/helpers/hyrax/citations_behaviors/formatters/chicago_formatter.rb'
- 'app/helpers/hyrax/citations_behaviors/formatters/mla_formatter.rb'
- 'app/helpers/hyrax/collections_helper.rb'
- 'app/helpers/hyrax/content_block_helper_behavior.rb'
- 'app/helpers/hyrax/hyrax_helper_behavior.rb'
- 'app/presenters/hyrax/fixity_status_presenter.rb'
- 'app/presenters/hyrax/presents_attributes.rb'
- 'app/renderers/hyrax/renderers/attribute_renderer.rb'
- 'spec/views/hyrax/my/works/_list_works.html.erb_spec.rb'

Rails/UniqueValidationWithoutIndex:
Exclude:
- 'app/models/account.rb'
- 'app/models/domain_name.rb'
- 'app/models/hyrax/group.rb'

RSpec/DescribeClass:
Exclude:
- 'spec/requests/**/*'
- 'spec/abilities/**/*'
- 'spec/config/hyrax_events_spec.rb'
- 'spec/conversions/**/*'
- 'spec/features/**/*'
- 'spec/inputs/**/*'
- 'spec/javascripts/jasmine_spec.rb'
- 'spec/tasks/rake_spec.rb'
- 'spec/views/**/*'
- 'spec/routing/**/*'
- 'spec/tasks/**/*'

Rails/FilePath:
Exclude:
- 'spec/routing/**/*'
# # By default RSpec/MessageSpies has the following:
# # Prefer have_received for setting message expectations. Setup form as a spy using allow or instance_spy.
# # The default assumes EnforcedStyle is 'have_received'. Most of our specs are 'receive'
RSpec/MessageSpies:
Enabled: false

RSpec/ExpectActual:
Exclude:
- 'spec/routing/**/*'
Enabled: false

RSpec/VerifiedDoubles:
RSpec/LetSetup:
Enabled: false

RSpec/MessageExpectation:
Enabled: false

# By default RSpec/MessageSpies has the following:
# Prefer have_received for setting message expectations. Setup form as a spy using allow or instance_spy.
RSpec/MessageSpies:
Enabled: true
EnforcedStyle: receive

RSpec/ExampleLength:
Max: 20

RSpec/NestedGroups:
Max: 4

RSpec/MultipleExpectations:
Enabled: false

Metrics/BlockLength:
Exclude:
- 'spec/**/*.rb'
- 'lib/tasks/*.rake'
- 'app/controllers/catalog_controller.rb'
RSpec/LeadingSubject:
Enabled: false
Loading

0 comments on commit 17c9192

Please sign in to comment.