Skip to content

Commit

Permalink
Merge pull request #1051 from pod4lib/rails71
Browse files Browse the repository at this point in the history
Update to Rails 7.1
  • Loading branch information
corylown authored Aug 16, 2024
2 parents d3b5b75 + b38b4e6 commit b2ba4ca
Show file tree
Hide file tree
Showing 10 changed files with 446 additions and 127 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 7.0.0'
gem 'rails', '~> 7.1.3'

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"
Expand All @@ -12,7 +12,7 @@ gem 'sqlite3', '~> 1.4'
gem 'pg'

# Use Puma as the app server
gem 'puma', '~> 5.0'
gem 'puma', '>= 5.0'

# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
Expand Down
164 changes: 87 additions & 77 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,73 +1,82 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.8.4)
actionpack (= 7.0.8.4)
activesupport (= 7.0.8.4)
actioncable (7.1.3.4)
actionpack (= 7.1.3.4)
activesupport (= 7.1.3.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
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)
zeitwerk (~> 2.6)
actionmailbox (7.1.3.4)
actionpack (= 7.1.3.4)
activejob (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
mail (>= 2.7.1)
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)
actionmailer (7.1.3.4)
actionpack (= 7.1.3.4)
actionview (= 7.1.3.4)
activejob (= 7.1.3.4)
activesupport (= 7.1.3.4)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.8.4)
actionview (= 7.0.8.4)
activesupport (= 7.0.8.4)
rack (~> 2.0, >= 2.2.4)
rails-dom-testing (~> 2.2)
actionpack (7.1.3.4)
actionview (= 7.1.3.4)
activesupport (= 7.1.3.4)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
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)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.3.4)
actionpack (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.8.4)
activesupport (= 7.0.8.4)
actionview (7.1.3.4)
activesupport (= 7.1.3.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.8.4)
activesupport (= 7.0.8.4)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.1.3.4)
activesupport (= 7.1.3.4)
globalid (>= 0.3.6)
activejob-status (1.0.2)
activejob (>= 6.0)
activesupport (>= 6.0)
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)
activemodel (7.1.3.4)
activesupport (= 7.1.3.4)
activerecord (7.1.3.4)
activemodel (= 7.1.3.4)
activesupport (= 7.1.3.4)
timeout (>= 0.4.0)
activestorage (7.1.3.4)
actionpack (= 7.1.3.4)
activejob (= 7.1.3.4)
activerecord (= 7.1.3.4)
activesupport (= 7.1.3.4)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.8.4)
activesupport (7.1.3.4)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
Expand All @@ -82,7 +91,6 @@ GEM
bcrypt (3.1.20)
bcrypt_pbkdf (1.1.1)
bcrypt_pbkdf (1.1.1-arm64-darwin)
bcrypt_pbkdf (1.1.1-x86_64-darwin)
bigdecimal (3.1.8)
bindex (0.8.1)
bootstrap_form (5.4.0)
Expand Down Expand Up @@ -158,6 +166,7 @@ GEM
ed25519
docile (1.4.1)
domain_name (0.6.20240107)
drb (2.2.1)
ed25519 (1.3.0)
erubi (1.13.0)
factory_bot (6.2.1)
Expand All @@ -166,7 +175,6 @@ GEM
factory_bot (~> 6.2.0)
railties (>= 5.0.0)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
ffi-compiler (1.3.2)
ffi (>= 1.15.5)
Expand Down Expand Up @@ -251,9 +259,9 @@ GEM
unf
marcel (1.0.4)
matrix (0.4.2)
method_source (1.1.0)
mini_mime (1.1.5)
minitest (5.24.1)
minitest (5.25.0)
mutex_m (0.2.0)
net-imap (0.4.14)
date
net-protocol
Expand All @@ -271,8 +279,6 @@ GEM
nio4r (2.7.3)
nokogiri (1.16.7-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
okcomputer (1.18.5)
Expand All @@ -288,28 +294,33 @@ GEM
psych (5.1.2)
stringio
public_suffix (6.0.1)
puma (5.6.8)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.8.1)
rack (2.2.9)
rack (3.1.7)
rack-attack (6.7.0)
rack (>= 1.0, < 4)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
rack (>= 1.3)
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)
rackup (2.1.0)
rack (>= 3)
webrick (~> 1.8)
rails (7.1.3.4)
actioncable (= 7.1.3.4)
actionmailbox (= 7.1.3.4)
actionmailer (= 7.1.3.4)
actionpack (= 7.1.3.4)
actiontext (= 7.1.3.4)
actionview (= 7.1.3.4)
activejob (= 7.1.3.4)
activemodel (= 7.1.3.4)
activerecord (= 7.1.3.4)
activestorage (= 7.1.3.4)
activesupport (= 7.1.3.4)
bundler (>= 1.15.0)
railties (= 7.0.8.4)
railties (= 7.1.3.4)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -324,13 +335,14 @@ GEM
rails-i18n (7.0.9)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (7.0.8.4)
actionpack (= 7.0.8.4)
activesupport (= 7.0.8.4)
method_source
railties (7.1.3.4)
actionpack (= 7.1.3.4)
activesupport (= 7.1.3.4)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.2.1)
rdoc (6.7.0)
Expand Down Expand Up @@ -427,7 +439,6 @@ GEM
activesupport (>= 6.1)
sprockets (>= 3.0.0)
sqlite3 (1.7.3-arm64-darwin)
sqlite3 (1.7.3-x86_64-darwin)
sqlite3 (1.7.3-x86_64-linux)
sshkit (1.23.0)
base64
Expand Down Expand Up @@ -465,6 +476,7 @@ GEM
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.8.1)
websocket (1.2.11)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
Expand All @@ -477,8 +489,6 @@ GEM

PLATFORMS
arm64-darwin-23
x86_64-darwin-19
x86_64-darwin-22
x86_64-linux

DEPENDENCIES
Expand Down Expand Up @@ -516,9 +526,9 @@ DEPENDENCIES
okcomputer
paper_trail
pg
puma (~> 5.0)
puma (>= 5.0)
rack-attack
rails (~> 7.0.0)
rails (~> 7.1.3)
rails-controller-testing
redis (~> 5.0)
rexml
Expand Down
12 changes: 8 additions & 4 deletions app/models/upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ class Upload < ApplicationRecord

after_create :attach_file_from_url

after_save_commit :perform_extract_marc_record_metadata_job, if: :active?
after_save_commit :perform_extract_files_job, if: :active?

# This should be after any callbacks that interact with the attached upload
# This should be _before_ any callbacks that interact with the attached upload
# See https://github.com/rails/rails/issues/37304
has_many_attached :files

after_save_commit :perform_extract_marc_record_metadata_job, if: :active?
after_save_commit :perform_extract_files_job, if: :active?

def active?
status == 'active'
end
Expand Down Expand Up @@ -73,10 +73,14 @@ def url_presence_if_no_uploaded_files
end

def perform_extract_marc_record_metadata_job
return unless files.any?(&:saved_changes?)

ExtractMarcRecordMetadataJob.perform_later(self)
end

def perform_extract_files_job
return unless files.any?(&:saved_changes?)

ExtractFilesJob.perform_later(self)
end

Expand Down
2 changes: 1 addition & 1 deletion bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require "fileutils"
APP_ROOT = File.expand_path('..', __dir__)

def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
system(*args, exception: true)
end

FileUtils.chdir APP_ROOT do
Expand Down
5 changes: 5 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.1

# Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded.
# Common ones are `templates`, `generators`, or `middleware`, for example.
config.autoload_lib(ignore: %w(assets tasks))

# Configuration for the application, engines, and railties goes here.
#
# These settings can be overridden in specific environments using the files
Expand Down
8 changes: 7 additions & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
config.enable_reloading = true

# Do not eager load code on boot.
config.eager_load = false
Expand Down Expand Up @@ -59,6 +59,9 @@
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true

# Highlight code that enqueued background job in logs.
config.active_job.verbose_enqueue_logs = true

# Suppress logger output for asset requests.
config.assets.quiet = true

Expand All @@ -70,4 +73,7 @@

# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true

# Raise error when a before_action's only/except options reference missing actions
config.action_controller.raise_on_missing_callback_actions = true
end
Loading

0 comments on commit b2ba4ca

Please sign in to comment.