From 31a9014f90a53e2470ba93439cb5edee10d74741 Mon Sep 17 00:00:00 2001 From: Christina Chortaria Date: Tue, 27 Aug 2024 10:58:34 -0400 Subject: [PATCH 1/7] [#3321] Upgrade to Rails 7 Remove config.autoloader. the setter has been deleted. See: https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#the-setter-config-autoloader-has-been-deleted --- Gemfile | 3 +- Gemfile.lock | 341 ++++++++++++++++++++++-------------------- config/application.rb | 3 +- db/schema.rb | 37 +++-- 4 files changed, 200 insertions(+), 184 deletions(-) diff --git a/Gemfile b/Gemfile index 6484a72c0..318431637 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' -gem 'rails', '~> 6.1' +gem 'rails', '~> 7.0.0' gem 'alma' gem 'babel-transpiler' @@ -78,6 +78,7 @@ gem 'sass-rails', '~> 6.0' gem 'simple_form' gem 'sneakers' gem 'sprockets-es6' +gem 'sprockets-rails' # For call-stack profiling flamegraphs gem 'stackprof' gem 'stringex', git: 'https://github.com/pulibrary/stringex.git', tag: 'vpton.2.5.2.2' diff --git a/Gemfile.lock b/Gemfile.lock index acb48a139..0ddf0b947 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -17,82 +17,88 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (6.1.7.8) - actionpack (= 6.1.7.8) - activesupport (= 6.1.7.8) + actioncable (7.0.8.4) + actionpack (= 7.0.8.4) + activesupport (= 7.0.8.4) 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) + actionmailbox (7.0.8.4) + actionpack (= 7.0.8.4) + activejob (= 7.0.8.4) + activerecord (= 7.0.8.4) + activestorage (= 7.0.8.4) + activesupport (= 7.0.8.4) 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) + net-imap + net-pop + net-smtp + actionmailer (7.0.8.4) + actionpack (= 7.0.8.4) + actionview (= 7.0.8.4) + activejob (= 7.0.8.4) + activesupport (= 7.0.8.4) mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp 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) + actionpack (7.0.8.4) + actionview (= 7.0.8.4) + activesupport (= 7.0.8.4) + 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.8) - actionpack (= 6.1.7.8) - activerecord (= 6.1.7.8) - activestorage (= 6.1.7.8) - activesupport (= 6.1.7.8) + actiontext (7.0.8.4) + actionpack (= 7.0.8.4) + activerecord (= 7.0.8.4) + activestorage (= 7.0.8.4) + activesupport (= 7.0.8.4) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.1.7.8) - activesupport (= 6.1.7.8) + actionview (7.0.8.4) + activesupport (= 7.0.8.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.7.8) - activesupport (= 6.1.7.8) + activejob (7.0.8.4) + activesupport (= 7.0.8.4) globalid (>= 0.3.6) - activemodel (6.1.7.8) - activesupport (= 6.1.7.8) - activerecord (6.1.7.8) - activemodel (= 6.1.7.8) - activesupport (= 6.1.7.8) - 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) + activemodel (7.0.8.4) + activesupport (= 7.0.8.4) + activerecord (7.0.8.4) + activemodel (= 7.0.8.4) + activesupport (= 7.0.8.4) + activestorage (7.0.8.4) + actionpack (= 7.0.8.4) + activejob (= 7.0.8.4) + activerecord (= 7.0.8.4) + activesupport (= 7.0.8.4) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.7.8) + activesupport (7.0.8.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - zeitwerk (~> 2.3) - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) - airbrussh (1.5.0) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + airbrussh (1.5.2) sshkit (>= 1.6.1, != 1.7.0) - alma (0.4.2) + alma (0.5.1) activesupport httparty xml-simple amq-protocol (2.3.2) ast (2.4.2) - autoprefixer-rails (10.4.15.0) + autoprefixer-rails (10.4.19.0) execjs (~> 2) - axe-core-api (4.8.0) + axe-core-api (4.10.0) dumb_delegator virtus - axe-core-rspec (4.8.0) - axe-core-api + axe-core-rspec (4.10.0) + axe-core-api (= 4.10.0) dumb_delegator virtus axiom-types (0.1.1) @@ -104,11 +110,11 @@ GEM babel-source (>= 4.0, < 6) execjs (~> 2.0) backport (1.2.0) - base64 (0.1.1) + base64 (0.2.0) bcrypt (3.1.20) - bcrypt_pbkdf (1.1.0) - benchmark (0.2.1) - better_html (2.0.2) + bcrypt_pbkdf (1.1.1) + benchmark (0.3.0) + better_html (2.1.1) actionview (>= 6.0) activesupport (>= 6.0) ast (~> 2.0) @@ -132,7 +138,7 @@ GEM ostruct (>= 0.3.2) rails (>= 5.1, < 7.3) view_component (>= 2.66, < 4) - blacklight-marc (8.1.0) + blacklight-marc (8.1.4) blacklight (>= 7.11, < 9) library_stdnums marc (>= 0.4.3, < 2.0) @@ -145,36 +151,35 @@ GEM blacklight_dynamic_sitemap (1.0.0) blacklight (> 7.0) rails - blacklight_range_limit (8.4.0) + blacklight_range_limit (8.5.0) blacklight (>= 7.25.2, < 9) deprecation view_component (>= 2.54, < 4) - bootstrap (4.6.2) + bootstrap (4.6.2.1) autoprefixer-rails (>= 9.1.0) popper_js (>= 1.16.1, < 2) - sassc-rails (>= 2.0.0) builder (3.3.0) - bunny (2.22.0) + bunny (2.23.0) amq-protocol (~> 2.3, >= 2.3.1) sorted_set (~> 1, >= 1.0.2) byebug (11.1.3) - capistrano (3.18.0) + capistrano (3.19.1) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) sshkit (>= 1.9.0) - capistrano-bundler (2.1.0) + capistrano-bundler (2.1.1) capistrano (~> 3.1) capistrano-passenger (0.2.1) capistrano (~> 3.0) capistrano-rails (1.6.3) capistrano (~> 3.1) capistrano-bundler (>= 1.1, < 3) - capybara (3.39.2) + capybara (3.40.0) addressable matrix mini_mime (>= 0.1.3) - nokogiri (~> 1.8) + nokogiri (~> 1.11) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) @@ -190,9 +195,11 @@ GEM term-ansicolor (~> 1.7) thor (~> 1.2) tins (~> 1.32) - crack (0.4.5) + crack (1.0.0) + bigdecimal rexml crass (1.0.6) + csv (3.3.0) date (3.3.4) ddtrace (1.14.0) debase-ruby_core_source (= 3.2.1) @@ -210,46 +217,45 @@ GEM railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-guests (0.8.1) + devise-guests (0.8.3) devise - diff-lcs (1.5.0) - docile (1.4.0) - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) + diff-lcs (1.5.1) + docile (1.4.1) + domain_name (0.6.20240107) dot-properties (0.1.4) bundler (>= 2.2.33) - dry-cli (1.0.0) + dry-cli (1.1.0) dumb_delegator (1.0.0) e2mmap (0.1.0) ed25519 (1.3.0) email_validator (2.2.4) activemodel - erb_lint (0.5.0) + erb_lint (0.6.0) activesupport better_html (>= 2.0.1) parser (>= 2.7.1.4) rainbow - rubocop + rubocop (>= 1) smart_properties - erblint-github (0.5.1) + erblint-github (1.0.1) erubi (1.13.0) execjs (2.9.1) - factory_bot (6.2.1) + factory_bot (6.4.6) activesupport (>= 5.0.0) - factory_bot_rails (6.2.0) - factory_bot (~> 6.2.0) + factory_bot_rails (6.4.3) + factory_bot (~> 6.4) railties (>= 5.0.0) - faker (3.2.1) + faker (3.4.2) i18n (>= 1.8.11, < 2) - faraday (2.7.11) - base64 - faraday-net_http (>= 2.0, < 3.1) - ruby2_keywords (>= 0.0.4) + faraday (2.11.0) + faraday-net_http (>= 2.0, < 3.4) + logger faraday-cookie_jar (0.0.7) faraday (>= 0.8.0) http-cookie (~> 1.0.0) - faraday-net_http (3.0.2) - ffi (1.16.3) + faraday-net_http (3.3.0) + net-http + ffi (1.17.0) ffi-compiler (1.3.2) ffi (>= 1.15.5) rake @@ -262,29 +268,31 @@ GEM activesupport (>= 2.0) globalid (1.2.1) activesupport (>= 6.1) - hashdiff (1.0.1) + hashdiff (1.1.1) hashie (5.0.0) - health-monitor-rails (12.2.0) + health-monitor-rails (12.3.0) railties (>= 6.1) - high_voltage (3.1.2) - honeybadger (5.3.0) - http (5.1.1) + high_voltage (4.0.0) + honeybadger (5.15.6) + http (5.2.0) addressable (~> 2.8) + base64 (~> 0.1) http-cookie (~> 1.0) http-form_data (~> 2.2) - llhttp-ffi (~> 0.4.0) - http-cookie (1.0.5) + llhttp-ffi (~> 0.5.0) + http-cookie (1.0.7) domain_name (~> 0.5) http-form_data (2.3.0) - httparty (0.21.0) + httparty (0.22.0) + csv mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) httpclient (2.8.3) i18n (1.14.5) concurrent-ruby (~> 1.0) ice_nine (0.11.2) - jaro_winkler (1.5.6) - jbuilder (2.11.5) + jaro_winkler (1.6.0) + jbuilder (2.12.0) actionview (>= 5.0.0) activesupport (>= 5.0.0) jquery-datatables (1.10.20) @@ -319,9 +327,10 @@ GEM libddwaf (1.9.0.0.1-x86_64-linux) ffi (~> 1.0) library_stdnums (1.6.0) - llhttp-ffi (0.4.0) + llhttp-ffi (0.5.0) ffi-compiler (~> 1.0) rake (~> 13.0) + logger (1.6.0) lograge (0.14.0) actionpack (>= 4) activesupport (>= 4) @@ -342,30 +351,33 @@ GEM unf marc-fastxmlwriter (1.1.0) marc (~> 1.0) - marcel (1.0.2) + marcel (1.0.4) matrix (0.4.2) - memory_profiler (1.0.1) + memory_profiler (1.0.2) method_source (1.1.0) mini_mime (1.1.5) mini_portile2 (2.8.7) minitest (5.25.1) - mize (0.5.0) msgpack (1.7.2) multi_xml (0.6.0) - net-imap (0.4.4) + net-http (0.4.1) + uri + net-imap (0.4.14) date net-protocol - net-ldap (0.18.0) + net-ldap (0.19.0) net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout net-scp (4.0.0) net-ssh (>= 2.6.5, < 8.0.0) - net-smtp (0.4.0) + net-sftp (4.0.0) + net-ssh (>= 5.0.0, < 8.0.0) + net-smtp (0.5.0) net-protocol - net-ssh (7.2.0) - nio4r (2.7.0) + net-ssh (7.2.3) + nio4r (2.7.3) nokogiri (1.16.7) mini_portile2 (~> 2.8.2) racc (~> 1.4) @@ -389,12 +401,12 @@ GEM scrub_rb (~> 1.0) orm_adapter (0.5.0) ostruct (0.6.0) - parallel (1.23.0) - parser (3.2.2.4) + parallel (1.26.3) + parser (3.3.4.2) ast (~> 2.4.1) racc parslet (2.0.0) - pg (1.5.6) + pg (1.5.7) popper_js (1.16.1) pry (0.14.2) coderay (~> 1.1) @@ -402,14 +414,14 @@ GEM pry-byebug (3.10.1) byebug (~> 11.0) pry (>= 0.13, < 0.15) - public_suffix (5.0.5) + public_suffix (6.0.1) puma (6.4.2) nio4r (~> 2.0) racc (1.8.1) rack (2.2.9) rack-attack (6.7.0) rack (>= 1.0, < 4) - rack-mini-profiler (3.1.1) + rack-mini-profiler (3.3.1) rack (>= 1.2.0) rack-protection (3.2.0) base64 (>= 0.1.0) @@ -418,21 +430,20 @@ GEM rack rack-test (2.1.0) rack (>= 1.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) + rails (7.0.8.4) + actioncable (= 7.0.8.4) + actionmailbox (= 7.0.8.4) + actionmailer (= 7.0.8.4) + actionpack (= 7.0.8.4) + actiontext (= 7.0.8.4) + actionview (= 7.0.8.4) + activejob (= 7.0.8.4) + activemodel (= 7.0.8.4) + activerecord (= 7.0.8.4) + activestorage (= 7.0.8.4) + activesupport (= 7.0.8.4) bundler (>= 1.15.0) - railties (= 6.1.7.8) - sprockets-rails (>= 2.0.0) + railties (= 7.0.8.4) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -444,20 +455,21 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (6.1.7.8) - actionpack (= 6.1.7.8) - activesupport (= 6.1.7.8) + railties (7.0.8.4) + actionpack (= 7.0.8.4) + activesupport (= 7.0.8.4) method_source rake (>= 12.2) thor (~> 1.0) + zeitwerk (~> 2.5) rainbow (3.1.1) rake (13.2.1) rbtree (0.4.6) - redis (5.0.8) - redis-client (>= 0.17.0) - redis-client (0.18.0) + redis (5.3.0) + redis-client (>= 0.22.0) + redis-client (0.22.2) connection_pool - regexp_parser (2.8.2) + regexp_parser (2.9.2) request_store (1.7.0) rack (>= 1.4) responders (3.1.1) @@ -467,26 +479,26 @@ GEM nokogiri rexml (3.3.6) strscan - rsolr (2.5.0) + rsolr (2.6.0) builder (>= 2.1.2) faraday (>= 0.9, < 3, != 2.0.0) - rspec-core (3.12.2) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.3) + rspec-core (3.13.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.2) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-mocks (3.12.6) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-rails (6.0.3) + rspec-support (~> 3.13.0) + rspec-rails (6.1.4) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) - rspec-core (~> 3.12) - rspec-expectations (~> 3.12) - rspec-mocks (~> 3.12) - rspec-support (~> 3.12) - rspec-support (3.12.1) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) + rspec-support (3.13.1) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) rubocop (1.28.2) @@ -498,8 +510,8 @@ GEM rubocop-ast (>= 1.17.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.30.0) - parser (>= 3.2.1.0) + rubocop-ast (1.32.1) + parser (>= 3.3.1.0) rubocop-performance (1.19.1) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) @@ -510,7 +522,6 @@ GEM rubocop-rspec (2.11.1) rubocop (~> 1.19) ruby-progressbar (1.13.0) - ruby2_keywords (0.0.5) rubyzip (2.3.2) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) @@ -523,15 +534,17 @@ GEM sprockets-rails tilt scrub_rb (1.0.1) - selenium-webdriver (4.15.0) + selenium-webdriver (4.23.0) + base64 (~> 0.2) + logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) serverengine (2.0.7) sigdump (~> 0.2.2) - set (1.0.3) + set (1.1.0) sigdump (0.2.5) - simple_form (5.3.0) + simple_form (5.3.1) actionpack (>= 5.2) activemodel (>= 5.2) simplecov (0.22.0) @@ -573,33 +586,34 @@ GEM babel-source (>= 5.8.11) babel-transpiler sprockets (>= 3.0.0) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) + sprockets-rails (3.5.2) + actionpack (>= 6.1) + activesupport (>= 6.1) sprockets (>= 3.0.0) - sshkit (1.21.5) + sshkit (1.23.0) + base64 net-scp (>= 1.1.2) + net-sftp (>= 2.1.2) net-ssh (>= 2.8.0) - stackprof (0.2.25) + stackprof (0.2.26) string_rtl (0.1.0) strscan (3.1.0) sync (0.5.0) - term-ansicolor (1.10.4) - mize (~> 0.5) + term-ansicolor (1.11.2) tins (~> 1.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - terser (1.2.2) + terser (1.2.3) execjs (>= 0.3.0, < 3) thor (1.3.1) thread_safe (0.3.6) - tilt (2.3.0) - timecop (0.9.8) + tilt (2.4.0) + timecop (0.9.10) timeout (0.4.1) tins (1.33.0) bigdecimal sync - traject (3.8.1) + traject (3.8.2) concurrent-ruby (>= 0.8.0) dot-properties (>= 0.1.1) hashie (>= 3.1, < 6) @@ -612,11 +626,11 @@ GEM yell tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.8.2) + unf (0.2.0) unicode-display_width (2.5.0) - vcr (6.2.0) + uri (0.13.1) + vcr (6.3.1) + base64 view_component (2.83.0) activesupport (>= 5.2.0, < 8.0) concurrent-ruby (~> 1.0) @@ -628,7 +642,7 @@ GEM vite_rails (3.0.17) railties (>= 5.1, < 8) vite_ruby (~> 3.0, >= 3.2.2) - vite_ruby (3.5.0) + vite_ruby (3.8.0) dry-cli (>= 0.7, < 2) rack-proxy (~> 0.6, >= 0.6.1) zeitwerk (~> 2.2) @@ -636,11 +650,11 @@ GEM rack (>= 1.4) warden (1.2.9) rack (>= 2.0.9) - webmock (3.19.1) + webmock (3.23.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - websocket (1.2.10) + websocket (1.2.11) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -717,7 +731,7 @@ DEPENDENCIES puma (~> 6.4) rack-attack rack-mini-profiler - rails (~> 6.1) + rails (~> 7.0.0) rails-controller-testing rake redis @@ -731,6 +745,7 @@ DEPENDENCIES sneakers solargraph sprockets-es6 + sprockets-rails stackprof string_rtl stringex! diff --git a/config/application.rb b/config/application.rb index ee413640c..8a622df93 100644 --- a/config/application.rb +++ b/config/application.rb @@ -70,6 +70,7 @@ class Application < Rails::Application config.active_record.yaml_column_permitted_classes = [Symbol, Date, Time, Hash, HashWithIndifferentAccess] BlacklightDynamicSitemap::Engine.config.minimum_average_chunk = 500 - config.autoloader = :zeitwerk + + config.eager_load_paths << "#{Rails.root}/spec/mailers/previews" end end diff --git a/db/schema.rb b/db/schema.rb index b67eb3964..66fcd3573 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: 2024_07_25_171021) do - +ActiveRecord::Schema[7.0].define(version: 2024_07_25_171021) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" enable_extension "unaccent" @@ -57,8 +56,8 @@ create_table "announcements", force: :cascade do |t| t.string "text" - 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 end create_table "bookmarks", id: :serial, force: :cascade do |t| @@ -66,8 +65,8 @@ t.string "user_type" t.string "document_id" t.string "title" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "document_type" t.index ["user_id"], name: "index_bookmarks_on_user_id" end @@ -75,17 +74,17 @@ create_table "flipflop_features", force: :cascade do |t| t.string "key", null: false t.boolean "enabled", default: false, 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 end create_table "oauth_tokens", force: :cascade do |t| t.string "service", null: false t.string "endpoint", null: false t.string "token" - t.datetime "expiration_time" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "expiration_time", precision: nil + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["endpoint"], name: "index_oauth_tokens_on_endpoint", unique: true t.index ["service"], name: "index_oauth_tokens_on_service", unique: true end @@ -94,8 +93,8 @@ t.text "query_params" t.integer "user_id" t.string "user_type" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.index ["user_id"], name: "index_searches_on_user_id" end @@ -103,15 +102,15 @@ t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false t.string "reset_password_token" - t.datetime "reset_password_sent_at" - t.datetime "remember_created_at" + t.datetime "reset_password_sent_at", precision: nil + t.datetime "remember_created_at", precision: nil t.integer "sign_in_count", default: 0, null: false - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" + t.datetime "current_sign_in_at", precision: nil + t.datetime "last_sign_in_at", precision: nil t.string "current_sign_in_ip" t.string "last_sign_in_ip" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "provider" t.string "uid" t.string "username" From 456b981b7be541106fee2d5fc94009a77535806f Mon Sep 17 00:00:00 2001 From: Christina Chortaria Date: Tue, 27 Aug 2024 13:07:16 -0400 Subject: [PATCH 2/7] Run THOR_MERGE=code rails app:update --- bin/rails | 10 +- bin/rake | 8 +- bin/setup | 33 ++++ config/application.rb | 3 +- config/boot.rb | 6 +- config/cable.yml | 10 ++ config/environment.rb | 4 +- config/environments/development.rb | 2 + config/initializers/assets.rb | 11 +- .../initializers/content_security_policy.rb | 26 ++++ .../new_framework_defaults_7_0.rb | 142 ++++++++++++++++++ config/initializers/permissions_policy.rb | 12 ++ 12 files changed, 244 insertions(+), 23 deletions(-) create mode 100755 bin/setup create mode 100644 config/cable.yml create mode 100644 config/initializers/content_security_policy.rb create mode 100644 config/initializers/new_framework_defaults_7_0.rb create mode 100644 config/initializers/permissions_policy.rb diff --git a/bin/rails b/bin/rails index 7feb6a30e..efc037749 100755 --- a/bin/rails +++ b/bin/rails @@ -1,8 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path("../spring", __FILE__) -rescue LoadError -end -APP_PATH = File.expand_path('../../config/application', __FILE__) -require_relative '../config/boot' -require 'rails/commands' +APP_PATH = File.expand_path("../config/application", __dir__) +require_relative "../config/boot" +require "rails/commands" diff --git a/bin/rake b/bin/rake index 8017a0271..4fbf10b96 100755 --- a/bin/rake +++ b/bin/rake @@ -1,8 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path("../spring", __FILE__) -rescue LoadError -end -require_relative '../config/boot' -require 'rake' +require_relative "../config/boot" +require "rake" Rake.application.run diff --git a/bin/setup b/bin/setup new file mode 100755 index 000000000..ec47b79b3 --- /dev/null +++ b/bin/setup @@ -0,0 +1,33 @@ +#!/usr/bin/env ruby +require "fileutils" + +# path to your application root. +APP_ROOT = File.expand_path("..", __dir__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +FileUtils.chdir APP_ROOT do + # This script is a way to set up or update your development environment automatically. + # This script is idempotent, so that you can run it at any time and get an expectable outcome. + # Add necessary setup steps to this file. + + puts "== Installing dependencies ==" + system! "gem install bundler --conservative" + system("bundle check") || system!("bundle install") + + # puts "\n== Copying sample files ==" + # unless File.exist?("config/database.yml") + # FileUtils.cp "config/database.yml.sample", "config/database.yml" + # end + + puts "\n== Preparing database ==" + system! "bin/rails db:prepare" + + puts "\n== Removing old logs and tempfiles ==" + system! "bin/rails log:clear tmp:clear" + + puts "\n== Restarting application server ==" + system! "bin/rails restart" +end diff --git a/config/application.rb b/config/application.rb index 8a622df93..1c90f08b6 100644 --- a/config/application.rb +++ b/config/application.rb @@ -32,6 +32,7 @@ module Orangelight class Application < Rails::Application + config.load_defaults 7.0 # Before filter for Flipflop dashboard. Replace with a lambda or method name # defined in ApplicationController to implement access control. config.flipflop.dashboard_access_filter = :verify_admin! @@ -71,6 +72,6 @@ class Application < Rails::Application BlacklightDynamicSitemap::Engine.config.minimum_average_chunk = 500 - config.eager_load_paths << "#{Rails.root}/spec/mailers/previews" + config.eager_load_paths << Rails.root.join('spec', 'mailers', 'previews') end end diff --git a/config/boot.rb b/config/boot.rb index 7479b5aff..f1f3a4476 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,6 +1,4 @@ # frozen_string_literal: true +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) -# Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) - -require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) +require "bundler/setup" # Set up gems listed in the Gemfile. diff --git a/config/cable.yml b/config/cable.yml new file mode 100644 index 000000000..e63ce0c79 --- /dev/null +++ b/config/cable.yml @@ -0,0 +1,10 @@ +development: + adapter: async + +test: + adapter: test + +production: + adapter: redis + url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> + channel_prefix: orangelight_production diff --git a/config/environment.rb b/config/environment.rb index df598a35d..a21c0c584 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true - # Load the Rails application. -require File.expand_path('../application', __FILE__) +require_relative "application" # Initialize the Rails application. - Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index dc794c8e5..6bbd4785d 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -18,6 +18,8 @@ # since you don't have to restart the web server when you make code changes. config.cache_classes = false + config.assets.quiet = true + # Do not eager load code on boot. config.eager_load = false diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index c20bab036..3bb606b20 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,6 +1,13 @@ # frozen_string_literal: true - # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. -Rails.application.config.assets.version = '1.0' +Rails.application.config.assets.version = "1.0" + +# Add additional assets to the asset load path. +# Rails.application.config.assets.paths << Emoji.images_path + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in the app/assets +# folder are already added. +# Rails.application.config.assets.precompile += %w( admin.js admin.css ) diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb new file mode 100644 index 000000000..691cfa11a --- /dev/null +++ b/config/initializers/content_security_policy.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true +# Be sure to restart your server when you modify this file. + +# 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 +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https +# # 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 diff --git a/config/initializers/new_framework_defaults_7_0.rb b/config/initializers/new_framework_defaults_7_0.rb new file mode 100644 index 000000000..a13554e03 --- /dev/null +++ b/config/initializers/new_framework_defaults_7_0.rb @@ -0,0 +1,142 @@ +# frozen_string_literal: true +# Be sure to restart your server when you modify this file. +# +# This file eases your Rails 7.0 framework defaults upgrade. +# +# Uncomment each configuration one by one to switch to the new default. +# Once your application is ready to run with all new defaults, you can remove +# this file and set the `config.load_defaults` to `7.0`. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. +# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html + +# `button_to` view helper will render `