diff --git a/.env b/.env index e67aa74b2d..6371a8abd2 100644 --- a/.env +++ b/.env @@ -71,3 +71,4 @@ HYRAX_ANALYTICS=false ##END## Enable Google Analytics HYRAX_VALKYRIE=true +VALKYRIE_TRANSITION=true diff --git a/Gemfile b/Gemfile index b492a53f1d..4cc73942e2 100644 --- a/Gemfile +++ b/Gemfile @@ -13,7 +13,7 @@ end source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 6.0', github: 'rails/rails', branch: '6-1-stable' +gem 'rails', '~> 6.1.7.8' gem 'active_elastic_job', github: 'active-elastic-job/active-elastic-job', ref: 'ec51c5d9dedc4a1b47f2db41f26d5fceb251e979', group: %i[aws] gem 'active-fedora', '~> 14.0' @@ -51,12 +51,12 @@ gem 'good_job', '~> 2.99' gem 'googleauth', '~> 1.9.0' gem 'google-protobuf', force_ruby_platform: true # required because google-protobuf is not compatible with Alpine linux gem 'grpc', force_ruby_platform: true # required because google-protobuf is not compatible with Alpine linux -gem 'hyrax', github: 'samvera/hyrax', branch: 'double_combo' +gem 'hyrax', github: 'samvera/hyrax', branch: 'main' gem 'hyrax-doi', github: 'samvera-labs/hyrax-doi', branch: 'rails_hyrax_upgrade' gem 'hyrax-iiif_av', github: 'samvera-labs/hyrax-iiif_av', branch: 'rails_hyrax_upgrade' gem 'i18n-debug', require: false, group: %i[development test] gem 'i18n-tasks', group: %i[development test] -gem 'iiif_print', github: 'scientist-softserv/iiif_print', branch: 'main' +gem 'iiif_print' gem 'jbuilder', '~> 2.5' gem 'jquery-rails' # Use jquery as the JavaScript library gem 'openssl', '>= 3.2.0' diff --git a/Gemfile.lock b/Gemfile.lock index 339a977f45..c8a440360d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,92 +7,6 @@ GIT aws-sdk-sqs (~> 1) rails (>= 4.2) -GIT - remote: https://github.com/rails/rails.git - revision: d16199e507086e3d54d94253b7e1d87ead394d9f - branch: 6-1-stable - specs: - actioncable (6.1.7.6) - actionpack (= 6.1.7.6) - activesupport (= 6.1.7.6) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - actionmailbox (6.1.7.6) - actionpack (= 6.1.7.6) - activejob (= 6.1.7.6) - activerecord (= 6.1.7.6) - activestorage (= 6.1.7.6) - activesupport (= 6.1.7.6) - mail (>= 2.7.1) - actionmailer (6.1.7.6) - actionpack (= 6.1.7.6) - actionview (= 6.1.7.6) - activejob (= 6.1.7.6) - activesupport (= 6.1.7.6) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (6.1.7.6) - actionview (= 6.1.7.6) - activesupport (= 6.1.7.6) - rack (~> 2.0, >= 2.0.9) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7.6) - actionpack (= 6.1.7.6) - activerecord (= 6.1.7.6) - activestorage (= 6.1.7.6) - activesupport (= 6.1.7.6) - nokogiri (>= 1.8.5) - actionview (6.1.7.6) - activesupport (= 6.1.7.6) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.7.6) - activesupport (= 6.1.7.6) - globalid (>= 0.3.6) - activemodel (6.1.7.6) - activesupport (= 6.1.7.6) - activerecord (6.1.7.6) - activemodel (= 6.1.7.6) - activesupport (= 6.1.7.6) - activestorage (6.1.7.6) - actionpack (= 6.1.7.6) - activejob (= 6.1.7.6) - activerecord (= 6.1.7.6) - activesupport (= 6.1.7.6) - marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (6.1.7.6) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 1.6, < 2) - minitest (>= 5.1) - tzinfo (~> 2.0) - zeitwerk (~> 2.3) - rails (6.1.7.6) - actioncable (= 6.1.7.6) - actionmailbox (= 6.1.7.6) - actionmailer (= 6.1.7.6) - actionpack (= 6.1.7.6) - actiontext (= 6.1.7.6) - actionview (= 6.1.7.6) - activejob (= 6.1.7.6) - activemodel (= 6.1.7.6) - activerecord (= 6.1.7.6) - activestorage (= 6.1.7.6) - activesupport (= 6.1.7.6) - bundler (>= 1.15.0) - railties (= 6.1.7.6) - sprockets-rails (>= 2.0.0) - railties (6.1.7.6) - actionpack (= 6.1.7.6) - activesupport (= 6.1.7.6) - method_source - rake (>= 12.2) - thor (~> 1.0) - GIT remote: https://github.com/samvera-labs/hyku_knapsack.git revision: 5a7c54cace96881a3963ab2fd881ca6ea3f57372 @@ -147,8 +61,8 @@ GIT GIT remote: https://github.com/samvera/hyrax.git - revision: 6447872e0bcea17abfc1aab477f2eea57639298f - branch: double_combo + revision: d4e646c7613febd2195f3835d3b801c6aa7b601d + branch: main specs: hyrax (5.0.1) active-fedora (~> 14.0) @@ -168,6 +82,7 @@ GIT dry-logic (~> 1.5) dry-monads (~> 1.6) dry-validation (~> 1.10) + faraday (= 2.9.1) flipflop (~> 2.3) flot-rails (~> 0.0.6) font-awesome-rails (~> 4.2) @@ -218,18 +133,6 @@ GIT public_suffix (>= 2) rack (>= 1.3.6) -GIT - remote: https://github.com/scientist-softserv/iiif_print.git - revision: fb07dcdafdf1b2e7e05ebd34a50187bf69b46474 - branch: main - specs: - iiif_print (2.0.1) - blacklight_iiif_search (>= 1.0, < 3.0) - derivative-rodeo (~> 0.5) - hyrax (>= 2.5, < 6) - nokogiri (>= 1.13.2) - rdf-vocab (~> 3.0) - GIT remote: https://github.com/scientist-softserv/willow_sword.git revision: 38a0906647fae2020e8b0b08e296f85c457fcb34 @@ -253,6 +156,44 @@ GIT GEM remote: https://rubygems.org/ specs: + actioncable (6.1.7.8) + actionpack (= 6.1.7.8) + activesupport (= 6.1.7.8) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.1.7.8) + actionpack (= 6.1.7.8) + activejob (= 6.1.7.8) + activerecord (= 6.1.7.8) + activestorage (= 6.1.7.8) + activesupport (= 6.1.7.8) + mail (>= 2.7.1) + actionmailer (6.1.7.8) + actionpack (= 6.1.7.8) + actionview (= 6.1.7.8) + activejob (= 6.1.7.8) + activesupport (= 6.1.7.8) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.1.7.8) + actionview (= 6.1.7.8) + activesupport (= 6.1.7.8) + rack (~> 2.0, >= 2.0.9) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.1.7.8) + actionpack (= 6.1.7.8) + activerecord (= 6.1.7.8) + activestorage (= 6.1.7.8) + activesupport (= 6.1.7.8) + nokogiri (>= 1.8.5) + actionview (6.1.7.8) + activesupport (= 6.1.7.8) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) active-fedora (14.0.1) active-triples (>= 0.11.0, < 2.0.0) activemodel (>= 5.1) @@ -271,14 +212,35 @@ GEM active_encode (0.8.2) rails sprockets (< 4) + activejob (6.1.7.8) + activesupport (= 6.1.7.8) + globalid (>= 0.3.6) + activemodel (6.1.7.8) + activesupport (= 6.1.7.8) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) + activerecord (6.1.7.8) + activemodel (= 6.1.7.8) + activesupport (= 6.1.7.8) activerecord-import (1.7.0) activerecord (>= 4.2) activerecord-nulldb-adapter (1.0.1) activerecord (>= 5.2.0, < 7.2) + activestorage (6.1.7.8) + actionpack (= 6.1.7.8) + activejob (= 6.1.7.8) + activerecord (= 6.1.7.8) + activesupport (= 6.1.7.8) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (6.1.7.8) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) addressable (2.8.1) public_suffix (>= 2.0.2, < 6.0) aes_key_wrap (1.1.0) @@ -586,10 +548,8 @@ GEM factory_bot_rails (6.4.2) factory_bot (~> 6.4) railties (>= 5.0.0) - faraday (2.7.12) - base64 - faraday-net_http (>= 2.0, < 3.1) - ruby2_keywords (>= 0.0.4) + faraday (2.9.1) + faraday-net_http (>= 2.0, < 3.2) faraday-encoding (0.0.5) faraday faraday-excon (2.1.0) @@ -768,6 +728,12 @@ GEM json iiif_manifest (1.3.1) activesupport (>= 4) + iiif_print (3.0.1) + blacklight_iiif_search (>= 1.0, < 3.0) + derivative-rodeo (~> 0.5) + hyrax (>= 2.5, < 6) + nokogiri (>= 1.13.2) + rdf-vocab (~> 3.0) iso-639 (0.3.6) iso8601 (0.9.1) jaro_winkler (1.5.6) @@ -1060,6 +1026,21 @@ GEM rack (~> 2.2, >= 2.2.4) rack-test (0.7.0) rack (>= 1.0, < 3) + rails (6.1.7.8) + actioncable (= 6.1.7.8) + actionmailbox (= 6.1.7.8) + actionmailer (= 6.1.7.8) + actionpack (= 6.1.7.8) + actiontext (= 6.1.7.8) + actionview (= 6.1.7.8) + activejob (= 6.1.7.8) + activemodel (= 6.1.7.8) + activerecord (= 6.1.7.8) + activestorage (= 6.1.7.8) + activesupport (= 6.1.7.8) + bundler (>= 1.15.0) + railties (= 6.1.7.8) + sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -1077,6 +1058,12 @@ GEM actionview (> 3.1) activesupport (> 3.1) railties (> 3.1) + railties (6.1.7.8) + actionpack (= 6.1.7.8) + activesupport (= 6.1.7.8) + method_source + rake (>= 12.2) + thor (~> 1.0) rainbow (3.1.1) rake (13.1.0) rb-fsevent (0.11.2) @@ -1505,7 +1492,7 @@ DEPENDENCIES hyrax-iiif_av! i18n-debug i18n-tasks - iiif_print! + iiif_print jbuilder (~> 2.5) jquery-rails json-canonicalization (= 0.3.1) @@ -1528,7 +1515,7 @@ DEPENDENCIES pry-byebug puma (~> 5.6) rack-test (= 0.7.0) - rails (~> 6.0)! + rails (~> 6.1.7.8) rails-controller-testing rdf (~> 3.2) redcarpet diff --git a/app/models/concerns/hyrax/solr_document_behavior_decorator.rb b/app/models/concerns/hyrax/solr_document_behavior_decorator.rb new file mode 100644 index 0000000000..9429affd18 --- /dev/null +++ b/app/models/concerns/hyrax/solr_document_behavior_decorator.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# OVERRIDE Hyrax v5.0.1 for correct return on #hydra_model + +module Hyrax + module SolrDocumentBehaviorDecorator + # Remove this once https://github.com/samvera/hyrax/pull/6860 is merged + def hydra_model(classifier: nil) + model = first('has_model_ssim')&.safe_constantize + model = (first('has_model_ssim')&.+ 'Resource')&.safe_constantize if Hyrax.config.valkyrie_transition? + model || model_classifier(classifier).classifier(self).best_model + end + end +end + +Hyrax::SolrDocumentBehavior.prepend(Hyrax::SolrDocumentBehaviorDecorator) diff --git a/config/initializers/riiif.rb b/config/initializers/riiif.rb index bae90983cd..25a19e3c6d 100644 --- a/config/initializers/riiif.rb +++ b/config/initializers/riiif.rb @@ -1,4 +1,12 @@ # frozen_string_literal: true + +# Loading these constants during runtime would freeze the web service in development. +# Adding the requires here to load them on initialize. +require 'riiif/imagemagick_transformer' +require 'riiif/imagemagick_command_factory' +require 'riiif/crop' +require 'riiif/resize' + Rails.application.reloader.to_prepare do Riiif::Image.info_service = lambda do |id, _file| # id will look like a path to a pcdm:file diff --git a/ops/demo-deploy.tmpl.yaml b/ops/demo-deploy.tmpl.yaml index ce5ac32886..0b83bf3168 100644 --- a/ops/demo-deploy.tmpl.yaml +++ b/ops/demo-deploy.tmpl.yaml @@ -181,6 +181,8 @@ extraEnvVars: &envVars value: $SENTRY_DSN - name: SENTRY_ENVIRONMENT value: $SENTRY_ENVIRONMENT + - name: VALKYRIE_TRANSITION + value: "true" worker: replicaCount: 1 extraVolumeMounts: *volMounts diff --git a/ops/iiif-deploy.tmpl.yaml b/ops/iiif-deploy.tmpl.yaml index f0ddfa9264..099835a771 100644 --- a/ops/iiif-deploy.tmpl.yaml +++ b/ops/iiif-deploy.tmpl.yaml @@ -175,6 +175,8 @@ extraEnvVars: &envVars value: $SENTRY_DSN - name: SENTRY_ENVIRONMENT value: $SENTRY_ENVIRONMENT + - name: VALKYRIE_TRANSITION + value: "true" worker: replicaCount: 1 diff --git a/ops/iiif.tmpl.yaml b/ops/iiif.tmpl.yaml index 9b542d5b97..e423b6bc94 100644 --- a/ops/iiif.tmpl.yaml +++ b/ops/iiif.tmpl.yaml @@ -169,6 +169,8 @@ extraEnvVars: &envVars value: $SECRET_KEY_BASE - name: SENTRY_DSN value: $SENTRY_DSN + - name: VALKYRIE_TRANSITION + value: "true" worker: replicaCount: 1 diff --git a/ops/staging-deploy.tmpl.yaml b/ops/staging-deploy.tmpl.yaml index e2ec859156..f62dea2c1d 100644 --- a/ops/staging-deploy.tmpl.yaml +++ b/ops/staging-deploy.tmpl.yaml @@ -183,6 +183,8 @@ extraEnvVars: &envVars value: $SENTRY_DSN - name: SENTRY_ENVIRONMENT value: $SENTRY_ENVIRONMENT + - name: VALKYRIE_TRANSITION + value: "true" worker: replicaCount: 1 diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 26b27234b9..606707c2bd 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,6 +1,16 @@ # frozen_string_literal: true RSpec.describe User, type: :model do + include ActiveSupport::Testing::TimeHelpers + + before do + travel_to Time.zone.local(2024, 6, 15, 12, 0, 0) + end + + after do + travel_back + end + subject { FactoryBot.create(:user) } it 'validates email and password' do @@ -32,6 +42,8 @@ let(:yesterday_stats) { { new_file_downloads: 2, new_work_views: 3, total_file_downloads: 6, total_file_views: 7, total_work_views: 16 } } it 'returns a summary hash of prior months stats' do + # requires time traveling because the :stat_yesterday will be included which is the expected behavior + # but just throws the specs off on the first of the month expect(subject.statistics_for).to eq(user_stats) end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index f1125cb7fc..a6f1031606 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -10,6 +10,7 @@ ENV['HYKU_ADMIN_ONLY_TENANT_CREATION'] = nil ENV['HYKU_DEFAULT_HOST'] = nil ENV['HYKU_MULTITENANT'] = 'true' +ENV['VALKYRIE_TRANSITION'] = 'true' require 'simplecov' SimpleCov.start('rails') diff --git a/spec/services/iiif_print/tenant_config_spec.rb b/spec/services/iiif_print/tenant_config_spec.rb index 148ec31d8e..60b2dfeca2 100644 --- a/spec/services/iiif_print/tenant_config_spec.rb +++ b/spec/services/iiif_print/tenant_config_spec.rb @@ -13,6 +13,8 @@ RSpec.describe 'Tenant Config for IIIF Print' do let!(:test_strategy) { Flipflop::FeatureSet.current.test! } + after { test_strategy.switch!(:default_pdf_viewer, true) } + describe IiifPrint::TenantConfig do describe '.use_iiif_print?' do subject { described_class.use_iiif_print? } diff --git a/spec/tasks/migrate_hyku_commons_collection_thumbnails_to_valkyrie_spec.rb b/spec/tasks/migrate_hyku_commons_collection_thumbnails_to_valkyrie_spec.rb index 499b5e47de..71e9abacbf 100644 --- a/spec/tasks/migrate_hyku_commons_collection_thumbnails_to_valkyrie_spec.rb +++ b/spec/tasks/migrate_hyku_commons_collection_thumbnails_to_valkyrie_spec.rb @@ -8,7 +8,7 @@ let(:old_thumbnail_path) { Rails.root.join(File.join('public', thumbnail_path)) } before do - Rails.application.load_tasks + Rails.application.load_tasks if Rake::Task.tasks.empty? FileUtils.mkdir_p(File.dirname(old_thumbnail_path)) FileUtils.touch(old_thumbnail_path) allow(Apartment::Tenant).to receive(:switch!).with(account.tenant) { |&block| block&.call } diff --git a/spec/tasks/rake_spec.rb b/spec/tasks/rake_spec.rb index c4734c2cf5..ed1b1d38ce 100644 --- a/spec/tasks/rake_spec.rb +++ b/spec/tasks/rake_spec.rb @@ -5,7 +5,7 @@ RSpec.describe "Rake tasks" do before(:all) do - Rails.application.load_tasks + Rails.application.load_tasks if Rake::Task.tasks.empty? end describe "hyku:upgrade:clean_migrations" do diff --git a/spec/views/_user_util_links.html.erb_spec.rb b/spec/views/_user_util_links.html.erb_spec.rb index 3c5f5eb05d..8e8cf1957f 100644 --- a/spec/views/_user_util_links.html.erb_spec.rb +++ b/spec/views/_user_util_links.html.erb_spec.rb @@ -6,6 +6,8 @@ let(:admin_ability) { double(user_groups: ['admin']) } let(:user_ability) { double(user_groups: []) } + after { test_strategy.switch!(:show_login_link, true) } + context 'when feature flipper is on' do before { test_strategy.switch!(:show_login_link, true) } diff --git a/spec/views/themes/cultural_repository/_user_util_links.html.erb_spec.rb b/spec/views/themes/cultural_repository/_user_util_links.html.erb_spec.rb index 0f7ebc1a26..9cd3ac4480 100644 --- a/spec/views/themes/cultural_repository/_user_util_links.html.erb_spec.rb +++ b/spec/views/themes/cultural_repository/_user_util_links.html.erb_spec.rb @@ -6,6 +6,8 @@ let(:admin_ability) { double(user_groups: ['admin']) } let(:user_ability) { double(user_groups: []) } + after { test_strategy.switch!(:show_login_link, true) } + context 'when feature flipper is on' do before do test_strategy.switch!(:show_login_link, true) diff --git a/spec/views/themes/institutional_repository/_user_util_links.html.erb_spec.rb b/spec/views/themes/institutional_repository/_user_util_links.html.erb_spec.rb index 61e263fba7..09061650e1 100644 --- a/spec/views/themes/institutional_repository/_user_util_links.html.erb_spec.rb +++ b/spec/views/themes/institutional_repository/_user_util_links.html.erb_spec.rb @@ -6,6 +6,8 @@ let(:admin_ability) { double(user_groups: ['admin']) } let(:user_ability) { double(user_groups: []) } + after { test_strategy.switch!(:show_login_link, true) } + context 'when feature flipper is on' do before { test_strategy.switch!(:show_login_link, true) }