Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Rails 7 #2245

Merged
merged 5 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ gem 'orangetheses', github: 'pulibrary/orangetheses', ref: '4ac8dc2bd04b10db764f
gem 'pg'
gem "rack", ">= 2.0.6"
gem 'rack-conneg', '~> 0.1.5'
gem 'rails', '~> 6.1'
gem 'rails', '~> 7.0'
gem 'responders', '~> 3.0'
gem 'rest-client'
gem 'rsolr'
Expand All @@ -60,9 +60,9 @@ gem 'selenium-webdriver'
gem 'sidekiq', '<7'
gem 'stomp'
gem 'stringex', github: "pulibrary/stringex", tag: 'vpton.2.5.2.2'
gem 'terser'
gem 'traject'
gem 'turbolinks'
gem 'uglifier', '>= 1.3.0'
gem 'whenever', "~> 0.10"
gem 'yard'

Expand Down
142 changes: 74 additions & 68 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -56,65 +56,71 @@ GEM
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.7.4)
actionpack (= 6.1.7.4)
activesupport (= 6.1.7.4)
actioncable (7.0.7.2)
actionpack (= 7.0.7.2)
activesupport (= 7.0.7.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.7.4)
actionpack (= 6.1.7.4)
activejob (= 6.1.7.4)
activerecord (= 6.1.7.4)
activestorage (= 6.1.7.4)
activesupport (= 6.1.7.4)
actionmailbox (7.0.7.2)
actionpack (= 7.0.7.2)
activejob (= 7.0.7.2)
activerecord (= 7.0.7.2)
activestorage (= 7.0.7.2)
activesupport (= 7.0.7.2)
mail (>= 2.7.1)
actionmailer (6.1.7.4)
actionpack (= 6.1.7.4)
actionview (= 6.1.7.4)
activejob (= 6.1.7.4)
activesupport (= 6.1.7.4)
net-imap
net-pop
net-smtp
actionmailer (7.0.7.2)
actionpack (= 7.0.7.2)
actionview (= 7.0.7.2)
activejob (= 7.0.7.2)
activesupport (= 7.0.7.2)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (6.1.7.4)
actionview (= 6.1.7.4)
activesupport (= 6.1.7.4)
rack (~> 2.0, >= 2.0.9)
actionpack (7.0.7.2)
actionview (= 7.0.7.2)
activesupport (= 7.0.7.2)
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.4)
actionpack (= 6.1.7.4)
activerecord (= 6.1.7.4)
activestorage (= 6.1.7.4)
activesupport (= 6.1.7.4)
actiontext (7.0.7.2)
actionpack (= 7.0.7.2)
activerecord (= 7.0.7.2)
activestorage (= 7.0.7.2)
activesupport (= 7.0.7.2)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (6.1.7.4)
activesupport (= 6.1.7.4)
actionview (7.0.7.2)
activesupport (= 7.0.7.2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.7.4)
activesupport (= 6.1.7.4)
activejob (7.0.7.2)
activesupport (= 7.0.7.2)
globalid (>= 0.3.6)
activemodel (6.1.7.4)
activesupport (= 6.1.7.4)
activerecord (6.1.7.4)
activemodel (= 6.1.7.4)
activesupport (= 6.1.7.4)
activestorage (6.1.7.4)
actionpack (= 6.1.7.4)
activejob (= 6.1.7.4)
activerecord (= 6.1.7.4)
activesupport (= 6.1.7.4)
activemodel (7.0.7.2)
activesupport (= 7.0.7.2)
activerecord (7.0.7.2)
activemodel (= 7.0.7.2)
activesupport (= 7.0.7.2)
activestorage (7.0.7.2)
actionpack (= 7.0.7.2)
activejob (= 7.0.7.2)
activerecord (= 7.0.7.2)
activesupport (= 7.0.7.2)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.7.4)
activesupport (7.0.7.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
airbrussh (1.4.1)
Expand Down Expand Up @@ -244,8 +250,8 @@ GEM
rake
friendly_id (5.1.0)
activerecord (>= 4.0.0)
globalid (1.1.0)
activesupport (>= 5.0)
globalid (1.2.1)
activesupport (>= 6.1)
gyoku (1.4.0)
builder (>= 2.1.2)
rexml (~> 3.0)
Expand Down Expand Up @@ -325,12 +331,12 @@ GEM
mini_mime (1.1.5)
mini_portile2 (2.8.4)
minitar (0.9)
minitest (5.18.1)
minitest (5.20.0)
msgpack (1.6.0)
multi_json (1.10.1)
multi_xml (0.6.0)
multipart-post (2.3.0)
net-imap (0.3.6)
net-imap (0.3.7)
date
net-protocol
net-ldap (0.17.1)
Expand Down Expand Up @@ -388,38 +394,38 @@ GEM
rack (>= 1.0)
rack-test (2.1.0)
rack (>= 1.3)
rails (6.1.7.4)
actioncable (= 6.1.7.4)
actionmailbox (= 6.1.7.4)
actionmailer (= 6.1.7.4)
actionpack (= 6.1.7.4)
actiontext (= 6.1.7.4)
actionview (= 6.1.7.4)
activejob (= 6.1.7.4)
activemodel (= 6.1.7.4)
activerecord (= 6.1.7.4)
activestorage (= 6.1.7.4)
activesupport (= 6.1.7.4)
rails (7.0.7.2)
actioncable (= 7.0.7.2)
actionmailbox (= 7.0.7.2)
actionmailer (= 7.0.7.2)
actionpack (= 7.0.7.2)
actiontext (= 7.0.7.2)
actionview (= 7.0.7.2)
activejob (= 7.0.7.2)
activemodel (= 7.0.7.2)
activerecord (= 7.0.7.2)
activestorage (= 7.0.7.2)
activesupport (= 7.0.7.2)
bundler (>= 1.15.0)
railties (= 6.1.7.4)
sprockets-rails (>= 2.0.0)
railties (= 7.0.7.2)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
activesupport (>= 5.0.1.rc1)
rails-dom-testing (2.1.1)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (6.1.7.4)
actionpack (= 6.1.7.4)
activesupport (= 6.1.7.4)
railties (7.0.7.2)
actionpack (= 7.0.7.2)
activesupport (= 7.0.7.2)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
rb-fsevent (0.11.2)
Expand Down Expand Up @@ -534,7 +540,7 @@ GEM
minitar
retriable
ruby-progressbar
sprockets (4.2.0)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
sprockets-rails (3.4.2)
Expand All @@ -550,6 +556,8 @@ GEM
sync (0.5.0)
term-ansicolor (1.7.1)
tins (~> 1.0)
terser (1.1.18)
execjs (>= 0.3.0, < 3)
thor (1.2.2)
tilt (2.0.11)
timecop (0.9.5)
Expand All @@ -574,8 +582,6 @@ GEM
turbolinks-source (5.2.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
Expand All @@ -588,7 +594,7 @@ GEM
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.7.0)
websocket (1.2.9)
websocket-driver (0.7.5)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
whenever (0.11.0)
Expand All @@ -601,7 +607,7 @@ GEM
yard (0.9.28)
webrick (~> 1.7.0)
yell (2.2.2)
zeitwerk (2.6.8)
zeitwerk (2.6.11)

PLATFORMS
ruby
Expand Down Expand Up @@ -660,7 +666,7 @@ DEPENDENCIES
puma (~> 4.3)
rack (>= 2.0.6)
rack-conneg (~> 0.1.5)
rails (~> 6.1)
rails (~> 7.0)
rails-controller-testing
rerun (~> 0.10.0)
responders (~> 3.0)
Expand All @@ -680,10 +686,10 @@ DEPENDENCIES
solr_wrapper
stomp
stringex!
terser
timecop
traject
turbolinks
uglifier (>= 1.3.0)
webmock
whenever (~> 0.10)
yard
Expand Down
11 changes: 11 additions & 0 deletions app/controllers/users/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

class Users::SessionsController < Devise::SessionsController
def destroy
signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name))
flash[:alert] = I18n.t('users.signout_html')
set_flash_message :notice, :signed_out if signed_out && is_flashing_format?
yield if block_given?
respond_to_on_destroy
end
end
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
config.serve_static_files = false

# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
config.assets.js_compressor = :terser
# config.assets.css_compressor = :sass

# Do not fallback to assets pipeline if a precompiled asset is missed.
Expand Down
11 changes: 0 additions & 11 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -265,17 +265,6 @@
# config.omniauth_path_prefix = '/my_engine/users/auth'
end


Devise::SessionsController.class_eval do
def destroy
signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name))
flash[:alert] = "<strong><a href='https://fed.princeton.edu/cas/logout'>Sign out from CAS</a></strong>"
set_flash_message :notice, :signed_out if signed_out && is_flashing_format?
yield if block_given?
respond_to_on_destroy
end
end

Devise::FailureApp.class_eval do
def redirect
store_location!
Expand Down
14 changes: 8 additions & 6 deletions config/initializers/traject_initializer.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
if Rails.env.test? || Rails.env.development?
LocationMapsGeneratorService.generate_from_templates
else
LocationMapsGeneratorService.generate
Rails.application.reloader.to_prepare do
if Rails.env.test? || Rails.env.development?
LocationMapsGeneratorService.generate_from_templates
else
LocationMapsGeneratorService.generate
end

TRAJECT_INDEXER ||= IndexerService.build
end

TRAJECT_INDEXER ||= IndexerService.build
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ en:
users:
omniauth_callback:
unauthorized: Unauthorized user
signout_html: "<strong><a href='https://fed.princeton.edu/cas/logout'>Sign out from CAS</a></strong>"
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'sidekiq/pro/web'
Rails.application.routes.draw do
devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" }
devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks", sessions: "users/sessions" }
resources :dump_files, only: [:show]
resources :events, only: [:show, :index, :destroy]
resources :dumps, only: [:show]
Expand Down