From 40cbedc6f2dc2616d00ec3b32c1b6c52a0f28e19 Mon Sep 17 00:00:00 2001 From: Shane Murnaghan <1930474+murny@users.noreply.github.com> Date: Mon, 25 Sep 2023 18:15:08 -0600 Subject: [PATCH 01/12] Bump Rails version to 7.0 --- Gemfile | 2 +- Gemfile.lock | 212 ++++++++++++++++++++++++--------------------------- 2 files changed, 99 insertions(+), 115 deletions(-) diff --git a/Gemfile b/Gemfile index 785ceacdb..3d6bbe3b1 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ ruby '>= 3.1.4', '< 3.2' # Core Rails stuff gem 'image_processing' # for ActiveStorage Variants gem 'puma', '~> 6.4' -gem 'rails', '~> 6.1.7' +gem 'rails', '~> 7.0.8' # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker gem 'webpacker', '~> 5.4' diff --git a/Gemfile.lock b/Gemfile.lock index f6c57cfd0..bdc5f30fa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,40 +43,47 @@ GEM specs: aasm (5.5.0) concurrent-ruby (~> 1.0) - actioncable (6.1.7.6) - actionpack (= 6.1.7.6) - activesupport (= 6.1.7.6) + actioncable (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) 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) + actionmailbox (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) 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) + net-imap + net-pop + net-smtp + actionmailer (7.0.8) + actionpack (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activesupport (= 7.0.8) mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp 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) + actionpack (7.0.8) + actionview (= 7.0.8) + activesupport (= 7.0.8) + rack (~> 2.0, >= 2.2.4) 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) + actiontext (7.0.8) + actionpack (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.1.7.6) - activesupport (= 6.1.7.6) + actionview (7.0.8) + activesupport (= 7.0.8) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -84,26 +91,26 @@ GEM active_link_to (1.0.5) actionpack addressable - activejob (6.1.7.6) - activesupport (= 6.1.7.6) + activejob (7.0.8) + activesupport (= 7.0.8) globalid (>= 0.3.6) - activemodel (6.1.7.6) - activesupport (= 6.1.7.6) + activemodel (7.0.8) + activesupport (= 7.0.8) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - 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) + activerecord (7.0.8) + activemodel (= 7.0.8) + activesupport (= 7.0.8) + activestorage (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activesupport (= 7.0.8) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.7.6) + activesupport (7.0.8) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -112,6 +119,7 @@ GEM addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) + base64 (0.1.1) bcp47_spec (0.2.1) bcrypt (3.1.20) better_errors (2.10.1) @@ -207,32 +215,14 @@ GEM tzinfo faker (3.2.3) i18n (>= 1.8.11, < 2) - faraday (1.10.3) - faraday-em_http (~> 1.0) - faraday-em_synchrony (~> 1.0) - faraday-excon (~> 1.1) - faraday-httpclient (~> 1.0) - faraday-multipart (~> 1.0) - faraday-net_http (~> 1.0) - faraday-net_http_persistent (~> 1.0) - faraday-patron (~> 1.0) - faraday-rack (~> 1.0) - faraday-retry (~> 1.0) + faraday (2.7.11) + base64 + faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) - faraday-em_http (1.0.0) - faraday-em_synchrony (1.0.0) - faraday-excon (1.1.0) faraday-http-cache (2.5.0) faraday (>= 0.8) - faraday-httpclient (1.0.1) - faraday-multipart (1.0.4) - multipart-post (~> 2) - faraday-net_http (1.0.1) - faraday-net_http_persistent (1.2.0) - faraday-patron (1.0.0) - faraday-rack (1.0.0) - faraday-retry (1.0.3) - ffi (1.15.5) + faraday-net_http (3.0.2) + ffi (1.16.2) flipper (1.0.0) brow (~> 0.4.1) concurrent-ruby (< 2) @@ -257,7 +247,7 @@ GEM google-api-client (0.53.0) google-apis-core (~> 0.1) google-apis-generator (~> 0.1) - google-apis-core (0.4.1) + google-apis-core (0.11.1) addressable (~> 2.5, >= 2.5.1) googleauth (>= 0.16.2, < 2.a) httpclient (>= 2.8.1, < 3.a) @@ -266,21 +256,20 @@ GEM retriable (>= 2.0, < 4.a) rexml webrick - google-apis-discovery_v1 (0.2.0) - google-apis-core (~> 0.1) - google-apis-generator (0.2.0) + google-apis-discovery_v1 (0.14.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-generator (0.12.0) activesupport (>= 5.0) gems (~> 1.2) - google-apis-core (~> 0.1) - google-apis-discovery_v1 (~> 0.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-discovery_v1 (~> 0.5) thor (>= 0.20, < 2.a) - googleauth (0.16.2) - faraday (>= 0.17.3, < 2.0) + googleauth (1.8.1) + faraday (>= 0.17.3, < 3.a) jwt (>= 1.4, < 3.0) - memoist (~> 0.16) multi_json (~> 1.11) os (>= 0.9, < 2.0) - signet (~> 0.14) + signet (>= 0.16, < 2.a) haikunator (1.1.1) hashdiff (1.0.1) hashie (5.0.0) @@ -297,7 +286,7 @@ GEM json (2.7.1) json-schema (4.1.1) addressable (>= 2.8) - jwt (2.2.3) + jwt (2.7.1) kaminari (1.2.2) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.2) @@ -332,9 +321,8 @@ GEM net-smtp marcel (1.0.2) matrix (0.4.2) - memoist (0.16.2) method_source (1.0.0) - mini_magick (4.11.0) + mini_magick (4.12.0) mini_mime (1.1.5) mini_portile2 (2.8.5) minitest (5.20.0) @@ -342,7 +330,6 @@ GEM minitest (>= 5.0) msgpack (1.7.2) multi_json (1.15.0) - multipart-post (2.3.0) nanoid (2.0.0) nap (1.1.0) net-http-persistent (4.0.2) @@ -375,7 +362,7 @@ GEM omniauth (~> 2.0) ruby-saml (~> 1.12) open4 (1.3.4) - os (1.1.1) + os (1.1.4) paper_trail (15.1.0) activerecord (>= 6.1) request_store (~> 1.4) @@ -392,6 +379,8 @@ GEM pry (>= 0.13, < 0.15) pry-rails (0.3.9) pry (>= 0.10.4) + psych (5.1.0) + stringio public_suffix (5.0.4) puma (6.4.2) nio4r (~> 2.0) @@ -402,25 +391,24 @@ GEM rack (2.2.8) rack-protection (3.1.0) rack (~> 2.2, >= 2.2.4) - rack-proxy (0.7.6) + rack-proxy (0.7.7) rack rack-test (2.1.0) rack (>= 1.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) + rails (7.0.8) + actioncable (= 7.0.8) + actionmailbox (= 7.0.8) + actionmailer (= 7.0.8) + actionpack (= 7.0.8) + actiontext (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activemodel (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) bundler (>= 1.15.0) - railties (= 6.1.7.6) - sprockets-rails (>= 2.0.0) + railties (= 7.0.8) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -428,12 +416,13 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (6.1.7.6) - actionpack (= 6.1.7.6) - activesupport (= 6.1.7.6) + railties (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) method_source rake (>= 12.2) thor (~> 1.0) + zeitwerk (~> 2.5) rainbow (3.1.1) rake (13.1.0) ransack (4.1.1) @@ -461,13 +450,14 @@ GEM rdf-xsd (3.3.0) rdf (~> 3.3) rexml (~> 3.2) - rdoc (6.3.3) + rdoc (6.5.0) + psych (>= 4.0.0) redcarpet (3.6.0) redis (4.8.1) redis-client (0.19.0) connection_pool regexp_parser (2.9.0) - representable (3.1.1) + representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) @@ -505,22 +495,22 @@ GEM rubocop (>= 1.33.0, < 2.0) rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (1.13.0) - ruby-saml (1.14.0) - nokogiri (>= 1.10.5) + ruby-saml (1.15.0) + nokogiri (>= 1.13.10) rexml ruby-vips (2.1.4) ffi (~> 1.12) ruby2_keywords (0.0.5) rubyzip (2.3.2) - sanitize (6.0.2) + sanitize (6.1.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) scanf (1.0.0) - sdoc (2.3.1) - rdoc (>= 5.0, < 6.4.0) + sdoc (2.6.1) + rdoc (>= 5.0) seed_dump (3.3.1) activerecord (>= 4) activesupport (>= 4) @@ -545,9 +535,9 @@ GEM concurrent-ruby (~> 1.0, >= 1.0.5) sidekiq (>= 7.0.0, < 8.0.0) thor (>= 1.0, < 3.0) - signet (0.15.0) - addressable (~> 2.3) - faraday (>= 0.17.3, < 2.0) + signet (0.18.0) + addressable (~> 2.8) + faraday (>= 0.17.5, < 3.a) jwt (>= 1.5, < 3.0) multi_json (~> 1.10) simple_form (5.3.0) @@ -572,13 +562,7 @@ GEM sparql-client (3.3.0) net-http-persistent (~> 4.0, >= 4.0.2) rdf (~> 3.3) - sprockets (4.2.1) - concurrent-ruby (~> 1.0) - rack (>= 2.2.4, < 4) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) - sprockets (>= 3.0.0) + stringio (3.0.8) strong_migrations (1.7.0) activerecord (>= 5.2) sxp (1.3.0) @@ -588,7 +572,7 @@ GEM unicode-display_width (>= 1.1.1, < 3) thor (1.3.0) timeout (0.4.1) - trailblazer-option (0.1.1) + trailblazer-option (0.1.2) tzinfo (2.0.6) concurrent-ruby (~> 1.0) uber (0.1.0) @@ -612,7 +596,7 @@ GEM rack-proxy (>= 0.6.1) railties (>= 5.2) semantic_range (>= 2.3.0) - webrick (1.7.0) + webrick (1.8.1) websocket (1.2.10) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) @@ -671,7 +655,7 @@ DEPENDENCIES pry-rails puma (~> 6.4) pundit (= 2.3.1) - rails (~> 6.1.7) + rails (~> 7.0.8) ransack (= 4.1.1) rdf (~> 3.3.1) rdf-isomorphic (~> 3.3.0) From f97d97fcaf2d91f3c0b301ecdede6463c989afc0 Mon Sep 17 00:00:00 2001 From: Shane Murnaghan <1930474+murny@users.noreply.github.com> Date: Mon, 25 Sep 2023 18:16:50 -0600 Subject: [PATCH 02/12] `require_dependency` no longer exists, update these --- config/application.rb | 4 ++-- config/routes.rb | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/config/application.rb b/config/application.rb index 8aae817c2..59deb83f6 100644 --- a/config/application.rb +++ b/config/application.rb @@ -22,8 +22,8 @@ module Jupiter class Application < Rails::Application - require_dependency 'lib/jupiter' - require_dependency 'lib/jupiter/version' + require_relative '../lib/jupiter' + require_relative '../lib/jupiter/version' # Initialize configuration defaults for originally generated Rails version. config.load_defaults 6.1 diff --git a/config/routes.rb b/config/routes.rb index 7640c4b0b..463da9311 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,9 +1,8 @@ require 'sidekiq/web' require 'sidekiq/cron/web' -require_dependency 'admin_constraint' -require_dependency 'entity_constraint' +require_relative '../lib/admin_constraint' +require_relative '../lib/entity_constraint' -# rubocop is bad and recommends insane things Rails.application.routes.draw do constraints(subdomain: 'era') do mount Oaisys::Engine, at: '/oai' From 088dc8348637a2a00e60d60906ed87e644365352 Mon Sep 17 00:00:00 2001 From: Shane Murnaghan <1930474+murny@users.noreply.github.com> Date: Tue, 10 Oct 2023 10:01:32 -0600 Subject: [PATCH 03/12] Fix rubocop for formatted string --- app/decorators/humanized_change_set.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/decorators/humanized_change_set.rb b/app/decorators/humanized_change_set.rb index 654b4df8a..9d41a1bc6 100644 --- a/app/decorators/humanized_change_set.rb +++ b/app/decorators/humanized_change_set.rb @@ -30,7 +30,7 @@ def user_info def date date = @date.in_time_zone(TIMEZONE) - date.to_formatted_s(:long) + date.to_fs(:long) end private @@ -153,7 +153,7 @@ def localize_date_to_timezone(attribute) @changeset[attribute].map do |date| next nil if date.nil? - date.in_time_zone(TIMEZONE).to_formatted_s(:long) + date.in_time_zone(TIMEZONE).to_fs(:long) end end From a10e7bb214783cc74e4a23b820eccf515c2deb30 Mon Sep 17 00:00:00 2001 From: Shane Murnaghan <1930474+murny@users.noreply.github.com> Date: Tue, 10 Oct 2023 10:13:42 -0600 Subject: [PATCH 04/12] Fix "TimeWithZone#to_s(:db) is deprecated. Please use TimeWithZone#to_fs(:db) instead." warnings --- test/fixtures/items.yml | 16 ++++++++-------- test/fixtures/thesis.yml | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/test/fixtures/items.yml b/test/fixtures/items.yml index 8a9d9f912..0b538544e 100644 --- a/test/fixtures/items.yml +++ b/test/fixtures/items.yml @@ -4,8 +4,8 @@ item_fancy: title: "Fancy Item" creators: ["Joe Blow"] created: "Fall 2017" - record_created_at: <%= 5.day.ago.to_s(:db) %> - updated_at: <%= 5.day.ago.to_s(:db) %> + record_created_at: <%= 5.day.ago.to_fs(:db) %> + updated_at: <%= 5.day.ago.to_fs(:db) %> date_ingested: <%= 5.day.ago %> languages: <%= [ControlledVocabulary.era.language.english] %> license: <%= ControlledVocabulary.era.license.attribution_4_0_international %> @@ -20,8 +20,8 @@ item_practical: title: "Fancy Item" creators: ["Joe Blow"] created: "Fall 2017" - record_created_at: <%= 5.day.ago.to_s(:db) %> - updated_at: <%= 5.day.ago.to_s(:db) %> + record_created_at: <%= 5.day.ago.to_fs(:db) %> + updated_at: <%= 5.day.ago.to_fs(:db) %> date_ingested: <%= 5.day.ago %> languages: <%= [ControlledVocabulary.era.language.english] %> license: <%= ControlledVocabulary.era.license.attribution_4_0_international %> @@ -68,7 +68,7 @@ item_admin: ingest_batch: "9019s326c" date_ingested: "2000-01-01T00:00:00.007Z" record_created_at: "2000-01-01T00:00:00.007Z" - updated_at: <%= 5.day.from_now.to_s(:db) %> + updated_at: <%= 5.day.from_now.to_fs(:db) %> item_private: visibility: <%= JupiterCore::VISIBILITY_PRIVATE %> @@ -77,7 +77,7 @@ item_private: creators: ["Joe Blow"] created: "Fall 2017" date_ingested: <%= 5.day.ago %> - record_created_at: <%= 5.day.ago.to_s(:db) %> + record_created_at: <%= 5.day.ago.to_fs(:db) %> languages: <%= [ControlledVocabulary.era.language.english] %> license: <%= ControlledVocabulary.era.license.attribution_4_0_international %> item_type: <%= ControlledVocabulary.era.item_type.article %> @@ -92,7 +92,7 @@ item_old_license: creators: ["Joe Blow"] created: "Winter 2017" date_ingested: <%= 5.day.ago %> - record_created_at: <%= 5.day.ago.to_s(:db) %> + record_created_at: <%= 5.day.ago.to_fs(:db) %> languages: <%= [ControlledVocabulary.era.language.english] %> license: <%= ControlledVocabulary.era.old_license.attribution_3_0_international %> item_type: <%= ControlledVocabulary.era.item_type.book %> @@ -106,7 +106,7 @@ item_authenticated: creators: ["Joe Blow"] created: "Fall 2017" date_ingested: <%= 5.day.ago %> - record_created_at: <%= 5.day.ago.to_s(:db) %> + record_created_at: <%= 5.day.ago.to_fs(:db) %> languages: <%= [ControlledVocabulary.era.language.english] %> license: <%= ControlledVocabulary.era.license.attribution_4_0_international %> item_type: <%= ControlledVocabulary.era.item_type.article %> diff --git a/test/fixtures/thesis.yml b/test/fixtures/thesis.yml index b6bba193c..f8ad2c29b 100644 --- a/test/fixtures/thesis.yml +++ b/test/fixtures/thesis.yml @@ -5,8 +5,8 @@ thesis_nice: dissertant: 'Joe Blow' graduation_date: '2019' date_ingested: <%= 5.day.ago %> - record_created_at: <%= 5.day.ago.to_s(:db) %> - updated_at: <%= 5.day.ago.to_s(:db) %> + record_created_at: <%= 5.day.ago.to_fs(:db) %> + updated_at: <%= 5.day.ago.to_fs(:db) %> abstract: 'This is my abstract' member_of_paths: <%= ["#{ActiveRecord::FixtureSet.identify(:community_thesis, :uuid)}/#{ActiveRecord::FixtureSet.identify(:collection_thesis, :uuid)}"] %> @@ -45,7 +45,7 @@ thesis_admin: committee_members: ['ual:commiteeMember1$ Hemmings, Denise (Obstetrics & Gynecology)', 'ual:commiteeMember2$ Humar, Atul (Medicine)', 'ual:commiteeMember3$ McMurtry, M. Sean (Medicine)'] aasm_state: 'available' record_created_at: '2018-03-13T16:52:49.818Z' - updated_at: <%= 5.day.ago.to_s(:db) %> + updated_at: <%= 5.day.ago.to_fs(:db) %> thesis_private: visibility: <%= JupiterCore::VISIBILITY_PRIVATE %> @@ -54,8 +54,8 @@ thesis_private: dissertant: 'Joe Blow' graduation_date: '2019' date_ingested: <%= 5.day.ago %> - record_created_at: <%= 5.day.ago.to_s(:db) %> - updated_at: <%= 10.day.ago.to_s(:db) %> + record_created_at: <%= 5.day.ago.to_fs(:db) %> + updated_at: <%= 10.day.ago.to_fs(:db) %> abstract: 'This is my abstract' member_of_paths: <%= ["#{ActiveRecord::FixtureSet.identify(:community_thesis, :uuid)}/#{ActiveRecord::FixtureSet.identify(:collection_thesis, :uuid)}"] %> @@ -66,19 +66,19 @@ thesis_fancy: dissertant: 'Joe Blow' graduation_date: '2019' date_ingested: <%= 5.day.ago %> - record_created_at: <%= 5.day.ago.to_s(:db) %> + record_created_at: <%= 5.day.ago.to_fs(:db) %> abstract: 'This is my abstract' member_of_paths: <%= ["#{ActiveRecord::FixtureSet.identify(:community_thesis, :uuid)}/#{ActiveRecord::FixtureSet.identify(:collection_thesis, :uuid)}"] %> thesis_embargoed: visibility: <%= JupiterCore::Depositable::VISIBILITY_EMBARGO %> visibility_after_embargo: <%= JupiterCore::VISIBILITY_PUBLIC %> - embargo_end_date: <%= 5.day.from_now.to_s(:db) %> + embargo_end_date: <%= 5.day.from_now.to_fs(:db) %> owner: user_admin title: 'Embargoed Item' dissertant: 'Joe Blow' graduation_date: '2019' date_ingested: <%= 5.day.ago %> - record_created_at: <%= 5.day.ago.to_s(:db) %> + record_created_at: <%= 5.day.ago.to_fs(:db) %> abstract: 'This is my abstract' member_of_paths: <%= ["#{ActiveRecord::FixtureSet.identify(:community_thesis, :uuid)}/#{ActiveRecord::FixtureSet.identify(:collection_embargoed, :uuid)}"] %> From 6c8294536a44570d934dc039b7b2b4ece1565269 Mon Sep 17 00:00:00 2001 From: Shane Murnaghan <1930474+murny@users.noreply.github.com> Date: Sat, 14 Oct 2023 14:06:36 -0600 Subject: [PATCH 05/12] Update files from generator --- Gemfile | 10 ++- Gemfile.lock | 31 +++------ app/models/application_record.rb | 2 +- bin/watchtower-post-update.sh | 0 config/application.rb | 2 +- config/environments/development.rb | 12 +--- config/environments/production.rb | 37 ++--------- config/environments/test.rb | 11 ++-- .../application_controller_renderer.rb | 8 --- config/initializers/assets.rb | 2 - config/initializers/backtrace_silencers.rb | 8 --- .../initializers/content_security_policy.rb | 64 +++++++++---------- config/initializers/cookies_serializer.rb | 5 -- .../initializers/filter_parameter_logging.rb | 4 +- config/initializers/mime_types.rb | 4 -- config/initializers/wrap_parameters.rb | 14 ---- config/puma.rb | 3 +- config/storage.yml | 10 +-- db/schema.rb | 43 ++++++------- 19 files changed, 92 insertions(+), 178 deletions(-) mode change 100644 => 100755 bin/watchtower-post-update.sh delete mode 100644 config/initializers/application_controller_renderer.rb delete mode 100644 config/initializers/backtrace_silencers.rb delete mode 100644 config/initializers/cookies_serializer.rb delete mode 100644 config/initializers/mime_types.rb delete mode 100644 config/initializers/wrap_parameters.rb diff --git a/Gemfile b/Gemfile index 3d6bbe3b1..f3ddb5fde 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ gem 'rails', '~> 7.0.8' gem 'webpacker', '~> 5.4' # Reduces boot times through caching; required in config/boot.rb -gem 'bootsnap', '>= 1.4.4', require: false +gem 'bootsnap', require: false # View stuff gem 'active_link_to' @@ -89,9 +89,8 @@ group :development, :test do gem 'erb_lint', '>= 0.0.35', require: false - gem 'pry' - gem 'pry-byebug' - gem 'pry-rails' + # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem + gem "debug", platforms: %i[ mri mingw x64_mingw ] gem 'rubocop', '~> 1.59.0', require: false gem 'rubocop-minitest', require: false @@ -102,9 +101,8 @@ end group :development do gem 'better_errors', '>= 2.3.0' gem 'binding_of_caller' + # gem "rack-mini-profiler" gem 'brakeman' - gem 'listen' - gem 'web-console', '>= 4.1.0' end diff --git a/Gemfile.lock b/Gemfile.lock index bdc5f30fa..1b8a9ad9a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -145,7 +145,6 @@ GEM concurrent-ruby (~> 1.0, >= 1.0.5) redis (>= 1.0, < 6) builder (3.2.4) - byebug (11.1.3) capybara (3.39.2) addressable matrix @@ -161,7 +160,6 @@ GEM nap open4 (~> 1.3) clamby (1.6.10) - coderay (1.1.3) colored2 (3.1.2) concurrent-ruby (1.2.2) connection_pool (2.4.1) @@ -184,6 +182,9 @@ GEM octokit (>= 4.0) terminal-table (>= 1, < 4) date (3.3.4) + debug (1.6.3) + irb (>= 1.3.6) + reline (>= 0.3.1) debug_inspector (1.1.0) declarative (0.0.20) differ (0.1.2) @@ -280,6 +281,9 @@ GEM image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) + io-console (0.5.11) + irb (1.4.1) + reline (>= 0.3.0) jbuilder (2.11.5) actionview (>= 5.0.0) activesupport (>= 5.0.0) @@ -307,9 +311,6 @@ GEM launchy (2.5.2) addressable (~> 2.8) link_header (0.0.8) - listen (3.8.0) - rb-fsevent (~> 0.10, >= 0.10.3) - rb-inotify (~> 0.9, >= 0.9.10) logger (1.5.3) loofah (2.22.0) crass (~> 1.0.2) @@ -371,14 +372,6 @@ GEM ast (~> 2.4.1) racc pg (1.5.4) - pry (0.14.2) - coderay (~> 1.1) - method_source (~> 1.0) - pry-byebug (3.10.1) - byebug (~> 11.0) - pry (>= 0.13, < 0.15) - pry-rails (0.3.9) - pry (>= 0.10.4) psych (5.1.0) stringio public_suffix (5.0.4) @@ -429,9 +422,6 @@ GEM activerecord (>= 6.1.5) activesupport (>= 6.1.5) i18n - rb-fsevent (0.11.2) - rb-inotify (0.10.1) - ffi (~> 1.0) rchardet (1.8.0) rdf (3.3.1) bcp47_spec (~> 0.2) @@ -457,6 +447,8 @@ GEM redis-client (0.19.0) connection_pool regexp_parser (2.9.0) + reline (0.3.1) + io-console (~> 0.5) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) @@ -618,7 +610,7 @@ DEPENDENCIES bcrypt (>= 3.1.13) better_errors (>= 2.3.0) binding_of_caller - bootsnap (>= 1.4.4) + bootsnap brakeman builder_deferred_tagging! capybara (>= 3.26, < 4.0) @@ -626,6 +618,7 @@ DEPENDENCIES connection_pool danger (~> 9.4) datacite-client! + debug differ draper edtf (~> 3.1) @@ -641,7 +634,6 @@ DEPENDENCIES json-schema (~> 4.1.1) kaminari launchy - listen minitest-retry nokogiri oaisys! @@ -650,9 +642,6 @@ DEPENDENCIES omniauth-saml (~> 2.1) paper_trail (~> 15.1.0) pg (~> 1.5.4) - pry - pry-byebug - pry-rails puma (~> 6.4) pundit (= 2.3.1) rails (~> 7.0.8) diff --git a/app/models/application_record.rb b/app/models/application_record.rb index c6ae68f2a..b70105ffe 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,5 +1,5 @@ class ApplicationRecord < ActiveRecord::Base - self.abstract_class = true + primary_abstract_class end diff --git a/bin/watchtower-post-update.sh b/bin/watchtower-post-update.sh old mode 100644 new mode 100755 diff --git a/config/application.rb b/config/application.rb index 59deb83f6..678b9b2c3 100644 --- a/config/application.rb +++ b/config/application.rb @@ -26,7 +26,7 @@ class Application < Rails::Application require_relative '../lib/jupiter/version' # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 6.1 + config.load_defaults 7.0 # Configuration for the application, engines, and railties goes here. # diff --git a/config/environments/development.rb b/config/environments/development.rb index 97568c02f..b5f7947c7 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -16,6 +16,9 @@ # Show full error reports. config.consider_all_requests_local = true + # Enable server timing + config.server_timing = true + # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. if Rails.root.join('tmp/caching-dev.txt').exist? @@ -55,11 +58,6 @@ # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true - # Debug mode disables concatenation and preprocessing of assets. - # This option may cause significant delays in view rendering with a large - # number of complex assets. - # config.assets.debug = true - # Suppress logger output for asset requests. # config.assets.quiet = true @@ -69,10 +67,6 @@ # Annotate rendered view with file names. # config.action_view.annotate_rendered_view_with_filenames = true - # Use an evented file watcher to asynchronously detect changes in source code, - # routes, locales, etc. This feature depends on the listen gem. - config.file_watcher = ActiveSupport::EventedFileUpdateChecker - # Uncomment if you wish to allow Action Cable access from any origin. # config.action_cable.disable_request_forgery_protection = true diff --git a/config/environments/production.rb b/config/environments/production.rb index 9e90c29eb..91a6378d7 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -55,7 +55,7 @@ # Use a real queuing backend for Active Job (and separate queues per environment). # config.active_job.queue_adapter = :resque - # config.active_job.queue_name_prefix = "jupiter_#{Rails.env}" + # config.active_job.queue_name_prefix = "jupiter_production" config.action_mailer.perform_caching = false @@ -65,19 +65,13 @@ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). - config.i18n.fallbacks = [:en] + config.i18n.fallbacks = true - # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify - - # Log disallowed deprecations. - config.active_support.disallowed_deprecation = :log - - # Tell Active Support which deprecation messages to disallow. - config.active_support.disallowed_deprecation_warnings = [] + # Don't log any deprecations. + config.active_support.report_deprecations = false # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = Logger::Formatter.new + config.log_formatter = ::Logger::Formatter.new # Use a different logger for distributed setups. # require 'syslog/logger' @@ -92,27 +86,6 @@ # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false - # Inserts middleware to perform automatic connection switching. - # The `database_selector` hash is used to pass options to the DatabaseSelector - # middleware. The `delay` is used to determine how long to wait after a write - # to send a subsequent read to the primary. - # - # The `database_resolver` class is used by the middleware to determine which - # database is appropriate to use based on the time delay. - # - # The `database_resolver_context` class is used by the middleware to set - # timestamps for the last write to the primary. The resolver uses the context - # class timestamps to determine how long to wait before reading from the - # replica. - # - # By default Rails will store a last write timestamp in the session. The - # DatabaseSelector middleware is designed as such you can define your own - # strategy for connection switching and pass that into the middleware through - # these configuration options. - # config.active_record.database_selector = { delay: 2.seconds } - # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver - # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session - # FITS characterization config.run_fits_characterization = true diff --git a/config/environments/test.rb b/config/environments/test.rb index 369f7509c..f9581517a 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -8,12 +8,13 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - config.cache_classes = false + # Turn false under Spring and add config.action_view.cache_template_loading = true. + config.cache_classes = true - # Do not eager load code on boot. This avoids loading your whole application - # just for the purpose of running a single test. If you are using a tool that - # preloads Rails for running tests, you may have to set it to true. - config.eager_load = true + # Eager loading loads your whole application. When running a single test locally, + # this probably isn't necessary. It's a good idea to do in a continuous integration + # system, or in some way before deploying your code. + config.eager_load = ENV["CI"].present? # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb deleted file mode 100644 index 89d2efab2..000000000 --- a/config/initializers/application_controller_renderer.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# ActiveSupport::Reloader.to_prepare do -# ApplicationController.renderer.defaults.merge!( -# http_host: 'example.org', -# https: false -# ) -# end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 49939e106..58cca8246 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -5,8 +5,6 @@ # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path -# Add Yarn node_modules folder to the asset load path. -# Rails.application.config.assets.paths << Rails.root.join('node_modules') # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in the app/assets diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb deleted file mode 100644 index d4d9b3b99..000000000 --- a/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code -# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'". -Rails.backtrace_cleaner.remove_silencers! if ENV['BACKTRACE'] diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 019d10b3f..2d0195675 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,36 +1,34 @@ # Be sure to restart your server when you modify this file. -# Define an application-wide content security policy -# For further information see the following documentation -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy - -Rails.application.config.content_security_policy do |policy| - policy.default_src :self, :https - policy.font_src :self, :https, :data - policy.img_src :self, :https, :data, - 'analytics.library.ualberta.ca', - 'www.google-analytics.com' - policy.object_src :none - policy.script_src :unsafe_inline, :self, :https, - 'analytics.library.ualberta.ca', - 'www.google-analytics.com', - 'www.googletagmanager.com' - - policy.style_src :unsafe_inline, :self, :https - - policy.connect_src :self, :https, 'http://localhost:3035', 'ws://localhost:3035' if Rails.env.development? - - # Specify URI for violation reports - # policy.report_uri "/csp-violation-report-endpoint" +# Define an application-wide content security policy. +# See the Securing Rails Applications Guide for more information: +# https://guides.rubyonrails.org/security.html#content-security-policy-header + +Rails.application.configure do + config.content_security_policy do |policy| + policy.default_src :self, :https + policy.font_src :self, :https, :data + policy.img_src :self, :https, :data, + 'analytics.library.ualberta.ca', + 'www.google-analytics.com' + policy.object_src :none + policy.script_src :unsafe_inline, :self, :https, + 'analytics.library.ualberta.ca', + 'www.google-analytics.com', + 'www.googletagmanager.com' + + policy.style_src :unsafe_inline, :self, :https + + policy.connect_src :self, :https, 'http://localhost:3035', 'ws://localhost:3035' if Rails.env.development? + + # Specify URI for violation reports + # policy.report_uri "/csp-violation-report-endpoint" + end + + # Generate session nonces for permitted importmap and inline scripts + # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } + # config.content_security_policy_nonce_directives = %w(script-src) + # + # # Report violations without enforcing the policy. + # # config.content_security_policy_report_only = true end - -# If you are using UJS then enable automatic nonce generation -# Rails.application.config.content_security_policy_nonce_generator = ->(_request) { SecureRandom.base64(16) } - -# Set the nonce only to specific directives -# Rails.application.config.content_security_policy_nonce_directives = %w(script-src) - -# Report CSP violations to a specified URI -# For further information see the following documentation: -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only -# Rails.application.config.content_security_policy_report_only = true diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb deleted file mode 100644 index 5a6a32d37..000000000 --- a/config/initializers/cookies_serializer.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Specify a serializer for the signed and encrypted cookie jars. -# Valid options are :json, :marshal, and :hybrid. -Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 4b34a0366..adc6568ce 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,6 +1,8 @@ # Be sure to restart your server when you modify this file. -# Configure sensitive parameters which will be filtered from the log file. +# Configure parameters to be filtered from the log file. Use this to limit dissemination of +# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported +# notations and behaviors. Rails.application.config.filter_parameters += [ :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn ] diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb deleted file mode 100644 index dc1899682..000000000 --- a/config/initializers/mime_types.rb +++ /dev/null @@ -1,4 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb deleted file mode 100644 index bbfc3961b..000000000 --- a/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] -end - -# To enable root element in JSON for ActiveRecord objects. -# ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true -# end diff --git a/config/puma.rb b/config/puma.rb index 28ed9c165..1f313200e 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -48,5 +48,6 @@ end end end -# Allow puma to be restarted by `rails restart` command. + +# Allow puma to be restarted by `bin/rails restart` command. plugin :tmp_restart diff --git a/config/storage.yml b/config/storage.yml index 8e709a69c..ad343109a 100644 --- a/config/storage.yml +++ b/config/storage.yml @@ -8,27 +8,27 @@ local: root: <%= Rails.application.secrets.active_storage_directory %> public: true -# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) +# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) # amazon: # service: S3 # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> # region: us-east-1 -# bucket: your_own_bucket +# bucket: your_own_bucket-<%= Rails.env %> # Remember not to checkin your GCS keyfile to a repository # google: # service: GCS # project: your_project # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> -# bucket: your_own_bucket +# bucket: your_own_bucket-<%= Rails.env %> -# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) +# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) # microsoft: # service: AzureStorage # storage_account_name: your_account_name # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> -# container: your_container_name +# container: your_container_name-<%= Rails.env %> # mirror: # service: Mirror diff --git a/db/schema.rb b/db/schema.rb index 7654dd21f..bc9f54905 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,8 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2023_09_20_041027) do - +ActiveRecord::Schema[7.0].define(version: 2023_10_14_195012) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -66,8 +65,8 @@ t.string "google_file_name", null: false t.string "google_file_id", null: false t.bigint "batch_ingest_id" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["batch_ingest_id"], name: "index_batch_ingest_files_on_batch_ingest_id" end @@ -82,8 +81,8 @@ t.string "google_spreadsheet_name", null: false t.string "google_spreadsheet_id", null: false t.bigint "user_id" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["title"], name: "index_batch_ingests_on_title", unique: true t.index ["user_id"], name: "index_batch_ingests_on_user_id" end @@ -127,8 +126,8 @@ t.integer "status", default: 0, null: false t.string "error_message" t.bigint "user_id" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["user_id"], name: "index_digitization_batch_metadata_ingests_on_user_id" end @@ -136,8 +135,8 @@ t.integer "peel_id" t.integer "run" t.integer "part_number" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.string "dates_issued", array: true t.string "temporal_subjects", array: true t.string "title", null: false @@ -168,15 +167,15 @@ create_table "digitization_fulltexts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "digitization_book_id", null: false t.text "text", null: false - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["digitization_book_id"], name: "index_digitization_fulltexts_on_digitization_book_id" end create_table "digitization_images", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "peel_image_id" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.datetime "date_ingested", null: false t.datetime "record_created_at" t.string "visibility" @@ -188,8 +187,8 @@ create_table "digitization_maps", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "peel_map_id" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.datetime "date_ingested", null: false t.datetime "record_created_at" t.string "visibility" @@ -204,8 +203,8 @@ t.string "year" t.string "month" t.string "day" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.datetime "date_ingested", null: false t.datetime "record_created_at" t.string "visibility" @@ -306,8 +305,8 @@ create_table "flipper_features", force: :cascade do |t| t.string "key", null: false - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["key"], name: "index_flipper_features_on_key", unique: true end @@ -315,8 +314,8 @@ t.string "feature_key", null: false t.string "key", null: false t.string "value" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["feature_key", "key", "value"], name: "index_flipper_gates_on_feature_key_and_key_and_value", unique: true end From 86bd2e8cd2a87db485d703276c0a8a3bcf5eed71 Mon Sep 17 00:00:00 2001 From: Shane Murnaghan <1930474+murny@users.noreply.github.com> Date: Sat, 14 Oct 2023 14:06:58 -0600 Subject: [PATCH 06/12] Fix bad fixture, associations do not exist causes issues --- test/fixtures/items.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/fixtures/items.yml b/test/fixtures/items.yml index 0b538544e..5d6df236c 100644 --- a/test/fixtures/items.yml +++ b/test/fixtures/items.yml @@ -16,7 +16,7 @@ item_fancy: item_practical: visibility: <%= JupiterCore::VISIBILITY_PUBLIC %> - owner: regular + owner: user_regular title: "Fancy Item" creators: ["Joe Blow"] created: "Fall 2017" @@ -28,7 +28,7 @@ item_practical: item_type: <%= ControlledVocabulary.era.item_type.article %> publication_status: <%= [ControlledVocabulary.era.publication_status.published] %> subject: ["Practical things"] - member_of_paths: <%= ["#{ActiveRecord::FixtureSet.identify(:fancy_community, :uuid)}/#{ActiveRecord::FixtureSet.identify(:fancy_collection, :uuid)}"] %> + member_of_paths: <%= ["#{ActiveRecord::FixtureSet.identify(:community_fancy, :uuid)}/#{ActiveRecord::FixtureSet.identify(:collection_fancy, :uuid)}"] %> # The admin item contains a base item entry that contains one of the possible value combinations that pass all validations # This is a radioactive item From f63ea33fdf8a4c3035073d6b00b7d45dff6dd158 Mon Sep 17 00:00:00 2001 From: Shane Murnaghan <1930474+murny@users.noreply.github.com> Date: Sat, 14 Oct 2023 14:20:49 -0600 Subject: [PATCH 07/12] Fix new changes in Rails 7, which uses VIPS by default and protects against external redirects --- app/controllers/admin/google_sessions_controller.rb | 2 +- config/application.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/google_sessions_controller.rb b/app/controllers/admin/google_sessions_controller.rb index 324292262..bfb53c9c4 100644 --- a/app/controllers/admin/google_sessions_controller.rb +++ b/app/controllers/admin/google_sessions_controller.rb @@ -5,7 +5,7 @@ def new if params['code'].nil? auth_uri = auth_client.authorization_uri.to_s - redirect_to auth_uri + redirect_to(auth_uri, allow_other_host: true) else auth_client.code = params['code'] auth_client.fetch_access_token! diff --git a/config/application.rb b/config/application.rb index 678b9b2c3..bdc0322b6 100644 --- a/config/application.rb +++ b/config/application.rb @@ -59,5 +59,9 @@ class Application < Rails::Application link_attributes: { rel: 'noopener noreferrer', target: '_blank' } } + # We should be using VIPS which is now the default, but this requires work to migrate? + # Delete this line if we ever migrate to VIPS + config.active_storage.variant_processor = :mini_magick + end end From bcfc8e1afe3cc8097a450965837758b39ba05fb4 Mon Sep 17 00:00:00 2001 From: Shane Murnaghan <1930474+murny@users.noreply.github.com> Date: Sat, 14 Oct 2023 17:00:56 -0600 Subject: [PATCH 08/12] Update branch to use hotfix in ActsAsRDF gem --- Gemfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Gemfile b/Gemfile index f3ddb5fde..af3ba75e5 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,11 @@ gem 'active_link_to' gem 'simple_form' # RDF stuff +<<<<<<< HEAD gem 'acts_as_rdfable', github: 'ualbertalib/acts_as_rdfable', tag: 'v0.5.0' +======= +gem 'acts_as_rdfable', github: 'ualbertalib/acts_as_rdfable', branch: 'fix-issue-with-singleton-class-in-rails-7' +>>>>>>> 44693108 (Update branch to use hotfix in ActsAsRDF gem) gem 'rdf', '~> 3.3.1' gem 'rdf-n3', '~> 3.3.0' gem 'rdf-vocab', '~> 3.3.0' # this gem changed predicate names without warning, be cautious and test with migrations From ea871a91d43a8ecc97e822510d7fca6a73350827 Mon Sep 17 00:00:00 2001 From: Shane Murnaghan <1930474+murny@users.noreply.github.com> Date: Sat, 14 Oct 2023 17:06:43 -0600 Subject: [PATCH 09/12] Fix rubocop violations --- Gemfile | 2 +- config/environments/production.rb | 2 +- config/environments/test.rb | 2 +- config/initializers/content_security_policy.rb | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index af3ba75e5..56c2bdaf3 100644 --- a/Gemfile +++ b/Gemfile @@ -94,7 +94,7 @@ group :development, :test do gem 'erb_lint', '>= 0.0.35', require: false # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem - gem "debug", platforms: %i[ mri mingw x64_mingw ] + gem 'debug', platforms: [:mri, :mingw, :x64_mingw] gem 'rubocop', '~> 1.59.0', require: false gem 'rubocop-minitest', require: false diff --git a/config/environments/production.rb b/config/environments/production.rb index 91a6378d7..e20aafe60 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -71,7 +71,7 @@ config.active_support.report_deprecations = false # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new + config.log_formatter = Logger::Formatter.new # Use a different logger for distributed setups. # require 'syslog/logger' diff --git a/config/environments/test.rb b/config/environments/test.rb index f9581517a..2cdb69ce6 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -14,7 +14,7 @@ # Eager loading loads your whole application. When running a single test locally, # this probably isn't necessary. It's a good idea to do in a continuous integration # system, or in some way before deploying your code. - config.eager_load = ENV["CI"].present? + config.eager_load = ENV['CI'].present? # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 2d0195675..080ffe311 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -9,13 +9,13 @@ policy.default_src :self, :https policy.font_src :self, :https, :data policy.img_src :self, :https, :data, - 'analytics.library.ualberta.ca', - 'www.google-analytics.com' + 'analytics.library.ualberta.ca', + 'www.google-analytics.com' policy.object_src :none policy.script_src :unsafe_inline, :self, :https, - 'analytics.library.ualberta.ca', - 'www.google-analytics.com', - 'www.googletagmanager.com' + 'analytics.library.ualberta.ca', + 'www.google-analytics.com', + 'www.googletagmanager.com' policy.style_src :unsafe_inline, :self, :https From 492ab099d780e2d6133c0fcf1f99c32dfd5cc258 Mon Sep 17 00:00:00 2001 From: Shane Murnaghan <1930474+murny@users.noreply.github.com> Date: Sat, 14 Oct 2023 17:12:48 -0600 Subject: [PATCH 10/12] Add changelog entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 396e3d711..77992ca8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ New entries in this file should aim to provide a meaningful amount of informatio ### Fixed - fix "include Pundit is deprecated. Please use include Pundit::Authorization instead." warnings [PR#3318](https://github.com/ualbertalib/jupiter/pull/3318) +### Added +- Rails 7 upgrade [PR#3250](https:://github.com/ualbertalib/jupiter/pull/3250) + ### Chores - Bump rubocop from 1.57.2 to 1.58.0 [PR#3299](https://github.com/ualbertalib/jupiter/pull/3299) - Bump rubocop-performance from 1.19.1 to 1.20.0 [PR#3315](https://github.com/ualbertalib/jupiter/pull/3315) From e5b3aa802f305dd3cb1bf7c92cb8644473040964 Mon Sep 17 00:00:00 2001 From: Shane Murnaghan <1930474+murny@users.noreply.github.com> Date: Wed, 8 Nov 2023 10:00:39 -0700 Subject: [PATCH 11/12] Use new ActsAsRDFable release v0.5.0, which contains a bug fix for Rails 7 --- Gemfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Gemfile b/Gemfile index 56c2bdaf3..07dc3ac9e 100644 --- a/Gemfile +++ b/Gemfile @@ -19,11 +19,7 @@ gem 'active_link_to' gem 'simple_form' # RDF stuff -<<<<<<< HEAD gem 'acts_as_rdfable', github: 'ualbertalib/acts_as_rdfable', tag: 'v0.5.0' -======= -gem 'acts_as_rdfable', github: 'ualbertalib/acts_as_rdfable', branch: 'fix-issue-with-singleton-class-in-rails-7' ->>>>>>> 44693108 (Update branch to use hotfix in ActsAsRDF gem) gem 'rdf', '~> 3.3.1' gem 'rdf-n3', '~> 3.3.0' gem 'rdf-vocab', '~> 3.3.0' # this gem changed predicate names without warning, be cautious and test with migrations From 1ddbf8df9b41529096eb2056cb0e8bf7c5f7f960 Mon Sep 17 00:00:00 2001 From: Shane Murnaghan <1930474+murny@users.noreply.github.com> Date: Mon, 15 Jan 2024 22:31:09 -0700 Subject: [PATCH 12/12] Make changes from review feedback --- Gemfile | 1 - config/application.rb | 4 ++-- config/routes.rb | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 07dc3ac9e..08d7dfe30 100644 --- a/Gemfile +++ b/Gemfile @@ -101,7 +101,6 @@ end group :development do gem 'better_errors', '>= 2.3.0' gem 'binding_of_caller' - # gem "rack-mini-profiler" gem 'brakeman' gem 'web-console', '>= 4.1.0' end diff --git a/config/application.rb b/config/application.rb index bdc0322b6..a185a8904 100644 --- a/config/application.rb +++ b/config/application.rb @@ -22,8 +22,8 @@ module Jupiter class Application < Rails::Application - require_relative '../lib/jupiter' - require_relative '../lib/jupiter/version' + require 'jupiter' + require 'jupiter/version' # Initialize configuration defaults for originally generated Rails version. config.load_defaults 7.0 diff --git a/config/routes.rb b/config/routes.rb index 463da9311..7a9cebb95 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,7 @@ require 'sidekiq/web' require 'sidekiq/cron/web' -require_relative '../lib/admin_constraint' -require_relative '../lib/entity_constraint' +require 'admin_constraint' +require 'entity_constraint' Rails.application.routes.draw do constraints(subdomain: 'era') do