Skip to content

Commit 2b73d13

Browse files
Upgrade Rails to 8.0.5
1 parent 4392129 commit 2b73d13

24 files changed

Lines changed: 202 additions & 172 deletions

.rubocop.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
require:
1+
plugins:
22
- rubocop-rails
33

44
AllCops:
5+
TargetRailsVersion: 8.0
56
UseCache: false
67
Exclude:
78
# Exclude generated files
@@ -185,7 +186,7 @@ Lint/TripleQuotes: # (new in 1.9)
185186
Enabled: true
186187
Style/IfWithBooleanLiteralBranches: # (new in 1.9)
187188
Enabled: true
188-
Gemspec/DateAssignment: # (new in 1.10)
189+
Gemspec/DeprecatedAttributeAssignment:
189190
Enabled: true
190191
Style/HashConversion: # (new in 1.10)
191192
Enabled: true

Gemfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@ ruby '~> 3.3'
55

66
gem 'berkeley_library-alma', '~> 0.1.1'
77
gem 'berkeley_library-logging', '~> 0.3'
8-
gem 'berkeley_library-util', '~> 0.2.0'
8+
gem 'berkeley_library-util', '~> 0.3'
99
gem 'drb'
1010
gem 'image_processing', '~> 1.12'
1111
gem 'jsonapi.rb', '~> 2.0'
1212
gem 'jsonapi-serializer', '~> 2.2'
1313
gem 'jwt', '~> 2.4'
1414
gem 'mutex_m'
15-
gem 'omniauth', '~> 1.9', '>= 1.9.2'
16-
gem 'omniauth-cas', '~> 2.0'
15+
gem 'omniauth', '~> 2.1'
16+
gem 'omniauth-cas', '~> 3.0'
17+
gem 'omniauth-rails_csrf_protection', '~> 1.0'
1718
gem 'pg', '~> 1.4'
1819
gem 'pg_search', '~> 2.3'
19-
gem 'puma', '~> 5.0'
20+
gem 'puma', '~> 7.2'
2021
gem 'rack-cors'
2122
gem 'rails', '~> 8.0.4'
2223
gem 'ransack', '~> 4.2'
@@ -30,9 +31,10 @@ end
3031

3132
group :development do
3233
gem 'hashdiff', '~> 1.0.1'
33-
gem 'rubocop', '~> 1.26.0'
34-
gem 'rubocop-rails', '~> 2.13.2', require: false
35-
gem 'rubocop-rspec', '~> 2.4.0', require: false
34+
gem 'rubocop', '~> 1.86'
35+
gem 'rubocop-rails', '~> 2.34', require: false
36+
gem 'rubocop-rspec', '~> 3.6', require: false
37+
gem 'rubocop-rspec_rails', '~> 2.30', require: false
3638
end
3739

3840
group :test do

Gemfile.lock

Lines changed: 70 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ GEM
7272
securerandom (>= 0.3)
7373
tzinfo (~> 2.0, >= 2.0.5)
7474
uri (>= 0.13.1)
75-
addressable (2.8.7)
76-
public_suffix (>= 2.0.2, < 7.0)
75+
addressable (2.8.9)
76+
public_suffix (>= 2.0.2, < 8.0)
7777
amazing_print (1.8.1)
7878
ast (2.4.3)
7979
base64 (0.3.0)
@@ -93,7 +93,7 @@ GEM
9393
marc (~> 1.0)
9494
parslet (~> 2.0)
9595
ruby-marc-spec (~> 0.1)
96-
berkeley_library-util (0.2.0)
96+
berkeley_library-util (0.3.0)
9797
berkeley_library-logging (~> 0.3)
9898
rest-client (~> 2.1)
9999
typesafe_enum (~> 0.3)
@@ -136,9 +136,10 @@ GEM
136136
globalid (1.3.0)
137137
activesupport (>= 6.1)
138138
hashdiff (1.0.1)
139-
hashie (5.0.0)
139+
hashie (5.1.0)
140+
logger
140141
http-accept (1.7.0)
141-
http-cookie (1.0.8)
142+
http-cookie (1.1.0)
142143
domain_name (~> 0.5)
143144
i18n (1.14.8)
144145
concurrent-ruby (~> 1.0)
@@ -151,13 +152,16 @@ GEM
151152
prism (>= 1.3.0)
152153
rdoc (>= 4.0.0)
153154
reline (>= 0.4.2)
155+
json (2.19.2)
154156
jsonapi-serializer (2.2.0)
155157
activesupport (>= 4.2)
156158
jsonapi.rb (2.1.1)
157159
jsonapi-serializer
158160
rack
159161
jwt (2.10.2)
160162
base64
163+
language_server-protocol (3.17.0.5)
164+
lint_roller (1.1.0)
161165
logger (1.7.0)
162166
lograge (0.14.0)
163167
actionpack (>= 4)
@@ -180,7 +184,7 @@ GEM
180184
mime-types (3.7.0)
181185
logger
182186
mime-types-data (~> 3.2025, >= 3.2025.0507)
183-
mime-types-data (3.2025.0819)
187+
mime-types-data (3.2026.0317)
184188
mini_magick (5.3.1)
185189
logger
186190
mini_mime (1.1.5)
@@ -209,21 +213,26 @@ GEM
209213
racc (~> 1.4)
210214
nokogiri (1.19.2-x86_64-linux-gnu)
211215
racc (~> 1.4)
212-
oj (3.16.11)
216+
oj (3.16.16)
213217
bigdecimal (>= 3.0)
214218
ostruct (>= 0.2)
215-
omniauth (1.9.2)
219+
omniauth (2.1.4)
216220
hashie (>= 3.4.6)
217-
rack (>= 1.6.2, < 3)
218-
omniauth-cas (2.0.0)
219-
addressable (~> 2.3)
220-
nokogiri (~> 1.5)
221-
omniauth (~> 1.2)
221+
logger
222+
rack (>= 2.2.3)
223+
rack-protection
224+
omniauth-cas (3.0.2)
225+
addressable (~> 2.8)
226+
nokogiri (~> 1.12)
227+
omniauth (~> 2.1)
228+
omniauth-rails_csrf_protection (1.0.2)
229+
actionpack (>= 4.2)
230+
omniauth (~> 2.0)
222231
ostruct (0.6.3)
223232
ougai (2.0.0)
224233
oj (~> 3.10)
225234
parallel (1.27.0)
226-
parser (3.3.9.0)
235+
parser (3.3.10.2)
227236
ast (~> 2.4.1)
228237
racc
229238
parslet (2.0.0)
@@ -241,20 +250,24 @@ GEM
241250
psych (5.3.1)
242251
date
243252
stringio
244-
public_suffix (6.0.2)
245-
puma (5.6.9)
253+
public_suffix (7.0.5)
254+
puma (7.2.0)
246255
nio4r (~> 2.0)
247256
racc (1.8.1)
248-
rack (2.2.22)
257+
rack (3.2.5)
249258
rack-cors (2.0.2)
250259
rack (>= 2.0.0)
251-
rack-session (1.0.2)
252-
rack (< 3)
260+
rack-protection (4.2.1)
261+
base64 (>= 0.1.0)
262+
logger (>= 1.6.0)
263+
rack (>= 3.0.0, < 4)
264+
rack-session (2.1.1)
265+
base64 (>= 0.1.0)
266+
rack (>= 3.0.0)
253267
rack-test (2.2.0)
254268
rack (>= 1.3)
255-
rackup (1.0.1)
256-
rack (< 3)
257-
webrick
269+
rackup (2.3.1)
270+
rack (>= 3)
258271
rails (8.0.5)
259272
actioncable (= 8.0.5)
260273
actionmailbox (= 8.0.5)
@@ -299,7 +312,7 @@ GEM
299312
erb
300313
psych (>= 4.0.0)
301314
tsort
302-
regexp_parser (2.11.2)
315+
regexp_parser (2.11.3)
303316
reline (0.6.3)
304317
io-console (~> 0.5)
305318
request_store (1.7.0)
@@ -309,7 +322,7 @@ GEM
309322
http-cookie (>= 1.0.2, < 2.0)
310323
mime-types (>= 1.16, < 4.0)
311324
netrc (~> 0.8)
312-
rexml (3.4.1)
325+
rexml (3.4.4)
313326
rspec (3.13.1)
314327
rspec-core (~> 3.13.0)
315328
rspec-expectations (~> 3.13.0)
@@ -333,25 +346,33 @@ GEM
333346
rspec-support (3.13.7)
334347
rspec_junit_formatter (0.6.0)
335348
rspec-core (>= 2, < 4, != 2.12.0)
336-
rubocop (1.26.1)
349+
rubocop (1.86.0)
350+
json (~> 2.3)
351+
language_server-protocol (~> 3.17.0.2)
352+
lint_roller (~> 1.1.0)
337353
parallel (~> 1.10)
338-
parser (>= 3.1.0.0)
354+
parser (>= 3.3.0.2)
339355
rainbow (>= 2.2.2, < 4.0)
340-
regexp_parser (>= 1.8, < 3.0)
341-
rexml
342-
rubocop-ast (>= 1.16.0, < 2.0)
356+
regexp_parser (>= 2.9.3, < 3.0)
357+
rubocop-ast (>= 1.49.0, < 2.0)
343358
ruby-progressbar (~> 1.7)
344-
unicode-display_width (>= 1.4.0, < 3.0)
345-
rubocop-ast (1.46.0)
359+
unicode-display_width (>= 2.4.0, < 4.0)
360+
rubocop-ast (1.49.1)
346361
parser (>= 3.3.7.2)
347-
prism (~> 1.4)
348-
rubocop-rails (2.13.2)
362+
prism (~> 1.7)
363+
rubocop-rails (2.34.3)
349364
activesupport (>= 4.2.0)
365+
lint_roller (~> 1.1)
350366
rack (>= 1.1)
351-
rubocop (>= 1.7.0, < 2.0)
352-
rubocop-rspec (2.4.0)
353-
rubocop (~> 1.0)
354-
rubocop-ast (>= 1.1.0)
367+
rubocop (>= 1.75.0, < 2.0)
368+
rubocop-ast (>= 1.44.0, < 2.0)
369+
rubocop-rspec (3.9.0)
370+
lint_roller (~> 1.1)
371+
rubocop (~> 1.81)
372+
rubocop-rspec_rails (2.32.0)
373+
lint_roller (~> 1.1)
374+
rubocop (~> 1.72, >= 1.72.1)
375+
rubocop-rspec (~> 3.5)
355376
ruby-marc-spec (0.1.3)
356377
marc (~> 1.1)
357378
parslet (~> 2.0)
@@ -376,14 +397,15 @@ GEM
376397
typesafe_enum (0.3.1)
377398
tzinfo (2.0.6)
378399
concurrent-ruby (~> 1.0)
379-
unicode-display_width (2.6.0)
400+
unicode-display_width (3.2.0)
401+
unicode-emoji (~> 4.1)
402+
unicode-emoji (4.2.0)
380403
uri (1.1.1)
381404
useragent (0.16.11)
382405
webmock (3.25.1)
383406
addressable (>= 2.8.0)
384407
crack (>= 0.3.2)
385408
hashdiff (>= 0.4.0, < 2.0.0)
386-
webrick (1.9.2)
387409
websocket-driver (0.8.0)
388410
base64
389411
websocket-extensions (>= 0.1.0)
@@ -400,7 +422,7 @@ PLATFORMS
400422
DEPENDENCIES
401423
berkeley_library-alma (~> 0.1.1)
402424
berkeley_library-logging (~> 0.3)
403-
berkeley_library-util (~> 0.2.0)
425+
berkeley_library-util (~> 0.3)
404426
brakeman
405427
bundle-audit
406428
colorize
@@ -413,21 +435,23 @@ DEPENDENCIES
413435
jsonapi.rb (~> 2.0)
414436
jwt (~> 2.4)
415437
mutex_m
416-
omniauth (~> 1.9, >= 1.9.2)
417-
omniauth-cas (~> 2.0)
438+
omniauth (~> 2.1)
439+
omniauth-cas (~> 3.0)
440+
omniauth-rails_csrf_protection (~> 1.0)
418441
pg (~> 1.4)
419442
pg_search (~> 2.3)
420-
puma (~> 5.0)
443+
puma (~> 7.2)
421444
rack-cors
422445
rails (~> 8.0.4)
423446
rails-controller-testing
424447
ransack (~> 4.2)
425448
rspec (~> 3.13)
426449
rspec-rails (~> 8.0)
427450
rspec_junit_formatter (~> 0.6)
428-
rubocop (~> 1.26.0)
429-
rubocop-rails (~> 2.13.2)
430-
rubocop-rspec (~> 2.4.0)
451+
rubocop (~> 1.86)
452+
rubocop-rails (~> 2.34)
453+
rubocop-rspec (~> 3.6)
454+
rubocop-rspec_rails (~> 2.30)
431455
simplecov (~> 0.22)
432456
simplecov-rcov (~> 0.3)
433457
webmock

app/controllers/application_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def authenticate!
3333
#
3434
# @return [User] the user
3535
def current_user
36-
@current_user ||= (user_from_token || default_user)
36+
@current_user ||= user_from_token || default_user
3737
end
3838

3939
# Require an authenticated user with admin privileges

app/controllers/concerns/exception_handlers.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module ExceptionHandlers
1010
#
1111
# - StandardError -> render_jsonapi_internal_server_error
1212
# - ActiveRecord::RecordNotFound -> render_jsonapi_not_found
13-
# - ActionController::ParameterMissing -> render_jsonapi_unprocessable_entity
13+
# - ActionController::ParameterMissing -> render_jsonapi_unprocessable_content
1414

1515
# rubocop:disable Metrics/BlockLength
1616
included do
@@ -21,8 +21,8 @@ module ExceptionHandlers
2121
rescue_from Error::ForbiddenError, with: :render_jsonapi_forbidden_error
2222
rescue_from ActionController::ParameterMissing, with: :render_jsonapi_parameter_missing
2323
rescue_from ActiveRecord::DeleteRestrictionError, with: :render_jsonapi_conflict
24-
rescue_from ActiveRecord::RecordInvalid, with: :render_validation_errors_as_unprocessable_entity
25-
rescue_from ActiveModel::ValidationError, with: :render_validation_errors_as_unprocessable_entity
24+
rescue_from ActiveRecord::RecordInvalid, with: :render_validation_errors_as_unprocessable_content
25+
rescue_from ActiveModel::ValidationError, with: :render_validation_errors_as_unprocessable_content
2626

2727
# ------------------------------------------------------------
2828
# Error handlers
@@ -40,13 +40,13 @@ def render_jsonapi_unauthorized_error(exception)
4040

4141
def render_jsonapi_parameter_missing(exception)
4242
logger.error(exception)
43-
render_jsonapi_error(:unprocessable_entity, detail: exception.message)
43+
render_jsonapi_error(:unprocessable_content, detail: exception.message)
4444
end
4545

46-
def render_validation_errors_as_unprocessable_entity(exception)
46+
def render_validation_errors_as_unprocessable_content(exception)
4747
logger.error(exception)
4848
errors = validation_errors_from(exception) || [exception]
49-
render jsonapi_errors: errors, status: :unprocessable_entity
49+
render jsonapi_errors: errors, status: :unprocessable_content
5050
end
5151

5252
# ------------------------------------------------------------
@@ -87,7 +87,8 @@ def render_jsonapi_conflict(exception)
8787
def validation_errors_from(exception)
8888
return unless (record = record_from(exception))
8989
return unless record.respond_to?(:errors) && (errors = record.errors)
90-
return errors if errors.is_a?(Enumerable)
90+
91+
errors if errors.is_a?(Enumerable)
9192
end
9293

9394
def render_jsonapi_error(status, detail: nil, meta: nil)

app/lib/cors_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def allow?(source, env = Rails.env)
1212

1313
def allowed_hosts
1414
config = Rails.application.config
15-
cors_hosts = (config.cors_hosts || [])
15+
cors_hosts = config.cors_hosts || []
1616
cors_hosts + config.hosts # TODO: should we only do this in dev?
1717
end
1818
end

app/models/closure.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def start_date_before_end_date
6767

6868
FILTER_QUERIES.each do |scope_name, query|
6969
scope scope_name, -> { where("id IN (#{query})").order(**DEFAULT_ORDER) }
70-
scope "not_#{scope_name}".to_sym, -> { where("id NOT IN (#{query})").order(**DEFAULT_ORDER) }
70+
scope :"not_#{scope_name}", -> { where("id NOT IN (#{query})").order(**DEFAULT_ORDER) }
7171
end
7272

7373
scope :filter_by, ->(filters) {

app/models/image.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def mime_type_of(uploaded_file)
127127

128128
def jpeg_tempfile_from(uploaded_file)
129129
mime_type = mime_type_of(uploaded_file)
130-
return uploaded_file if (mime_type) == JPEG_MIME_TYPE
130+
return uploaded_file if mime_type == JPEG_MIME_TYPE
131131

132132
logger.info("#{uploaded_file.path} (#{uploaded_file.original_filename}) is #{mime_type}; converting to #{JPEG_MIME_TYPE}")
133133
ImageProcessing::Vips.source(uploaded_file).convert('jpeg').call

app/services/availability_service.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def fetch_and_cache_availability_for(ids)
9090
# @param ids Array<String> a list of MMS IDs
9191
# @return Hash<String, Boolean> a hash from MMS IDs to availability.
9292
def fetch_availability_for(ids)
93-
records = get_marc_records(*ids, max_records: (max_records || ids.size))
93+
records = get_marc_records(*ids, max_records: max_records || ids.size)
9494

9595
# TODO: do we need to cache this?
9696
records.each_with_object({}) do |marc_record, availability|

0 commit comments

Comments
 (0)