Skip to content

Commit b643bd0

Browse files
committed
Upgrade to Rails 8.0 and apply new framework defaults
* Disable cache_store during tests and re-enable it only explicitly
1 parent 87c4003 commit b643bd0

26 files changed

+784
-471
lines changed

Gemfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ gem 'proformaxml', '~> 1.5.1'
3636
gem 'prometheus_exporter'
3737
gem 'puma'
3838
gem 'pundit'
39-
gem 'rails', '~> 7.2.2'
39+
gem 'rails', '~> 8.0.0'
4040
gem 'rails_admin'
4141
gem 'rails-i18n'
4242
gem 'rails-timeago'
@@ -75,8 +75,6 @@ group :development, :staging do
7575
gem 'i18n-tasks'
7676
gem 'letter_opener'
7777
gem 'listen'
78-
gem 'pry-byebug'
79-
gem 'pry-rails'
8078
gem 'rack-mini-profiler'
8179
gem 'rubocop'
8280
gem 'rubocop-capybara'

Gemfile.lock

Lines changed: 59 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -9,70 +9,69 @@ GIT
99
GEM
1010
remote: https://rubygems.org/
1111
specs:
12-
actioncable (7.2.2)
13-
actionpack (= 7.2.2)
14-
activesupport (= 7.2.2)
12+
actioncable (8.0.0)
13+
actionpack (= 8.0.0)
14+
activesupport (= 8.0.0)
1515
nio4r (~> 2.0)
1616
websocket-driver (>= 0.6.1)
1717
zeitwerk (~> 2.6)
18-
actionmailbox (7.2.2)
19-
actionpack (= 7.2.2)
20-
activejob (= 7.2.2)
21-
activerecord (= 7.2.2)
22-
activestorage (= 7.2.2)
23-
activesupport (= 7.2.2)
18+
actionmailbox (8.0.0)
19+
actionpack (= 8.0.0)
20+
activejob (= 8.0.0)
21+
activerecord (= 8.0.0)
22+
activestorage (= 8.0.0)
23+
activesupport (= 8.0.0)
2424
mail (>= 2.8.0)
25-
actionmailer (7.2.2)
26-
actionpack (= 7.2.2)
27-
actionview (= 7.2.2)
28-
activejob (= 7.2.2)
29-
activesupport (= 7.2.2)
25+
actionmailer (8.0.0)
26+
actionpack (= 8.0.0)
27+
actionview (= 8.0.0)
28+
activejob (= 8.0.0)
29+
activesupport (= 8.0.0)
3030
mail (>= 2.8.0)
3131
rails-dom-testing (~> 2.2)
32-
actionpack (7.2.2)
33-
actionview (= 7.2.2)
34-
activesupport (= 7.2.2)
32+
actionpack (8.0.0)
33+
actionview (= 8.0.0)
34+
activesupport (= 8.0.0)
3535
nokogiri (>= 1.8.5)
36-
racc
37-
rack (>= 2.2.4, < 3.2)
36+
rack (>= 2.2.4)
3837
rack-session (>= 1.0.1)
3938
rack-test (>= 0.6.3)
4039
rails-dom-testing (~> 2.2)
4140
rails-html-sanitizer (~> 1.6)
4241
useragent (~> 0.16)
43-
actiontext (7.2.2)
44-
actionpack (= 7.2.2)
45-
activerecord (= 7.2.2)
46-
activestorage (= 7.2.2)
47-
activesupport (= 7.2.2)
42+
actiontext (8.0.0)
43+
actionpack (= 8.0.0)
44+
activerecord (= 8.0.0)
45+
activestorage (= 8.0.0)
46+
activesupport (= 8.0.0)
4847
globalid (>= 0.6.0)
4948
nokogiri (>= 1.8.5)
50-
actionview (7.2.2)
51-
activesupport (= 7.2.2)
49+
actionview (8.0.0)
50+
activesupport (= 8.0.0)
5251
builder (~> 3.1)
5352
erubi (~> 1.11)
5453
rails-dom-testing (~> 2.2)
5554
rails-html-sanitizer (~> 1.6)
56-
activejob (7.2.2)
57-
activesupport (= 7.2.2)
55+
activejob (8.0.0)
56+
activesupport (= 8.0.0)
5857
globalid (>= 0.3.6)
59-
activemodel (7.2.2)
60-
activesupport (= 7.2.2)
58+
activemodel (8.0.0)
59+
activesupport (= 8.0.0)
6160
activemodel-serializers-xml (1.0.3)
6261
activemodel (>= 5.0.0.a)
6362
activesupport (>= 5.0.0.a)
6463
builder (~> 3.1)
65-
activerecord (7.2.2)
66-
activemodel (= 7.2.2)
67-
activesupport (= 7.2.2)
64+
activerecord (8.0.0)
65+
activemodel (= 8.0.0)
66+
activesupport (= 8.0.0)
6867
timeout (>= 0.4.0)
69-
activestorage (7.2.2)
70-
actionpack (= 7.2.2)
71-
activejob (= 7.2.2)
72-
activerecord (= 7.2.2)
73-
activesupport (= 7.2.2)
68+
activestorage (8.0.0)
69+
actionpack (= 8.0.0)
70+
activejob (= 8.0.0)
71+
activerecord (= 8.0.0)
72+
activesupport (= 8.0.0)
7473
marcel (~> 1.0)
75-
activesupport (7.2.2)
74+
activesupport (8.0.0)
7675
base64
7776
benchmark (>= 0.3)
7877
bigdecimal
@@ -84,6 +83,7 @@ GEM
8483
minitest (>= 5.1)
8584
securerandom (>= 0.3)
8685
tzinfo (~> 2.0, >= 2.0.5)
86+
uri (>= 0.13.1)
8787
addressable (2.8.7)
8888
public_suffix (>= 2.0.2, < 7.0)
8989
amq-protocol (2.3.2)
@@ -111,7 +111,6 @@ GEM
111111
bunny (2.23.0)
112112
amq-protocol (~> 2.3, >= 2.3.1)
113113
sorted_set (~> 1, >= 1.0.2)
114-
byebug (11.1.3)
115114
capybara (3.40.0)
116115
addressable
117116
matrix
@@ -133,7 +132,6 @@ GEM
133132
childprocess (5.1.0)
134133
logger (~> 1.5)
135134
chronic (0.10.2)
136-
coderay (1.1.3)
137135
concurrent-ruby (1.3.4)
138136
connection_pool (2.4.1)
139137
cose (1.3.1)
@@ -267,7 +265,6 @@ GEM
267265
net-smtp
268266
marcel (1.0.4)
269267
matrix (0.4.2)
270-
method_source (1.1.0)
271268
mimemagic (0.4.3)
272269
nokogiri (~> 1)
273270
rake
@@ -330,14 +327,6 @@ GEM
330327
rubyzip (>= 1.2.2, < 3.0.0)
331328
prometheus_exporter (2.2.0)
332329
webrick
333-
pry (0.14.2)
334-
coderay (~> 1.1)
335-
method_source (~> 1.0)
336-
pry-byebug (3.10.1)
337-
byebug (~> 11.0)
338-
pry (>= 0.13, < 0.15)
339-
pry-rails (0.3.11)
340-
pry (>= 0.13.0)
341330
psych (5.2.1)
342331
date
343332
stringio
@@ -359,20 +348,20 @@ GEM
359348
rack (>= 1.3)
360349
rackup (2.2.1)
361350
rack (>= 3)
362-
rails (7.2.2)
363-
actioncable (= 7.2.2)
364-
actionmailbox (= 7.2.2)
365-
actionmailer (= 7.2.2)
366-
actionpack (= 7.2.2)
367-
actiontext (= 7.2.2)
368-
actionview (= 7.2.2)
369-
activejob (= 7.2.2)
370-
activemodel (= 7.2.2)
371-
activerecord (= 7.2.2)
372-
activestorage (= 7.2.2)
373-
activesupport (= 7.2.2)
351+
rails (8.0.0)
352+
actioncable (= 8.0.0)
353+
actionmailbox (= 8.0.0)
354+
actionmailer (= 8.0.0)
355+
actionpack (= 8.0.0)
356+
actiontext (= 8.0.0)
357+
actionview (= 8.0.0)
358+
activejob (= 8.0.0)
359+
activemodel (= 8.0.0)
360+
activerecord (= 8.0.0)
361+
activestorage (= 8.0.0)
362+
activesupport (= 8.0.0)
374363
bundler (>= 1.15.0)
375-
railties (= 7.2.2)
364+
railties (= 8.0.0)
376365
rails-controller-testing (1.0.5)
377366
actionpack (>= 5.0.1.rc1)
378367
actionview (>= 5.0.1.rc1)
@@ -384,9 +373,9 @@ GEM
384373
rails-html-sanitizer (1.6.1)
385374
loofah (~> 2.21)
386375
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
387-
rails-i18n (7.0.10)
376+
rails-i18n (8.0.1)
388377
i18n (>= 0.7, < 2)
389-
railties (>= 6.0.0, < 8)
378+
railties (>= 8.0.0, < 9)
390379
rails-timeago (2.20.0)
391380
actionpack (>= 5.2)
392381
activesupport (>= 5.2)
@@ -397,9 +386,9 @@ GEM
397386
nested_form (~> 0.3)
398387
rails (>= 6.0, < 9)
399388
turbo-rails (>= 1.0, < 3)
400-
railties (7.2.2)
401-
actionpack (= 7.2.2)
402-
activesupport (= 7.2.2)
389+
railties (8.0.0)
390+
actionpack (= 8.0.0)
391+
activesupport (= 8.0.0)
403392
irb (~> 1.13)
404393
rackup (>= 1.0.0)
405394
rake (>= 12.2)
@@ -545,7 +534,7 @@ GEM
545534
fugit (~> 1.11.0)
546535
railties (>= 7.1)
547536
thor (~> 1.3.1)
548-
sorbet-runtime (0.5.11685)
537+
sorbet-runtime (0.5.11690)
549538
sorcery (0.17.0)
550539
bcrypt (~> 3.1)
551540
oauth (>= 0.6)
@@ -662,12 +651,10 @@ DEPENDENCIES
662651
pg
663652
proformaxml (~> 1.5.1)
664653
prometheus_exporter
665-
pry-byebug
666-
pry-rails
667654
puma
668655
pundit
669656
rack-mini-profiler
670-
rails (~> 7.2.2)
657+
rails (~> 8.0.0)
671658
rails-controller-testing
672659
rails-i18n
673660
rails-timeago

bin/dev

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env ruby
2+
exec "./bin/rails", "server", *ARGV

bin/setup

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33

44
require 'fileutils'
55

6-
# path to your application root.
76
APP_ROOT = File.expand_path('..', __dir__)
8-
APP_NAME = 'codeocean'
97

108
def system!(*)
119
system(*, exception: true)
@@ -17,7 +15,6 @@ FileUtils.chdir APP_ROOT do
1715
# Add necessary setup steps to this file.
1816

1917
puts '== Installing dependencies =='
20-
system! 'gem install bundler --conservative'
2118
system('bundle check') || system!('bundle install')
2219

2320
# Install JavaScript dependencies
@@ -36,10 +33,9 @@ FileUtils.chdir APP_ROOT do
3633
puts "\n== Removing old logs and tempfiles =="
3734
system! 'bin/rails log:clear tmp:clear'
3835

39-
puts "\n== Restarting application server =="
40-
system! 'bin/rails restart'
41-
42-
# puts "\n== Configuring puma-dev =="
43-
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
44-
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
36+
unless ARGV.include?('--skip-server')
37+
puts "\n== Starting development server =="
38+
$stdout.flush # flush the output before exec(2) so that it displays
39+
exec 'bin/dev'
40+
end
4541
end

bin/thrust

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env ruby
2+
require "rubygems"
3+
require "bundler/setup"
4+
5+
load Gem.bin_path("thruster", "thrust")

config/action_mailer.yml.ci

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ test:
22
default_options:
33
from: 'CodeOcean <codeocean@openhpi.de>'
44
default_url_options:
5-
host: localhost
5+
host: example.com
66
delivery_method: :test

config/action_mailer.yml.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ production:
2121
test:
2222
<<: *default
2323
default_url_options:
24-
host: localhost
24+
host: example.com
2525
delivery_method: :test

config/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
module CodeOcean
1515
class Application < Rails::Application
1616
# Initialize configuration defaults for originally generated Rails version.
17-
config.load_defaults 7.2
17+
config.load_defaults 8.0
1818

1919
# Please, add to the `ignore` list any other `lib` subdirectories that do
2020
# not contain `.rb` files, or that should not be reloaded or eager loaded.

config/environments/development.rb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@
1515
private_ips.each {|ip| BetterErrors::Middleware.allow_ip! ip }
1616
end
1717

18-
# In the development environment your application's code is reloaded any time
19-
# it changes. This slows down response time but is perfect for development
20-
# since you don't have to restart the web server when you make code changes.
18+
# Make code changes take effect immediately without server restart.
2119
config.enable_reloading = true
2220

23-
# Eager load code for prometheus exporter
21+
# Eager load code for prometheus exporter.
2422
config.eager_load = true
2523

2624
# Show full error reports.
@@ -29,22 +27,21 @@
2927
# Enable server timing.
3028
config.server_timing = true
3129

32-
# Enable/disable caching. By default caching is disabled.
33-
# Run rails dev:cache to toggle caching.
30+
# Enable/disable Action Controller caching. By default Action Controller caching is disabled.
31+
# Run rails dev:cache to toggle Action Controller caching.
3432
if Rails.root.join('tmp/caching-dev.txt').exist?
3533
config.action_controller.perform_caching = true
3634
config.action_controller.enable_fragment_cache_logging = true
37-
38-
config.cache_store = :memory_store
3935
config.public_file_server.headers = {
40-
'Cache-Control' => "public, max-age=#{2.days.to_i}",
36+
'cache-control' => "public, max-age=#{2.days.to_i}",
4137
}
4238
else
4339
config.action_controller.perform_caching = false
44-
45-
config.cache_store = :null_store
4640
end
4741

42+
# Change to :null_store to avoid any caching.
43+
config.cache_store = :memory_store
44+
4845
# Store uploaded files on the local file system (see config/storage.yml for options).
4946
config.active_storage.service = :local
5047

@@ -56,10 +53,10 @@
5653
config.solid_queue.connects_to = {database: {writing: :queue}}
5754
config.active_job.queue_name_prefix = 'codeocean_development'
5855

59-
# Disable caching for Action Mailer templates even if Action Controller
60-
# caching is enabled.
56+
# Make template changes take effect immediately.
6157
config.action_mailer.perform_caching = false
6258

59+
# Set localhost to be used by links generated in mailer templates.
6360
config.action_mailer.default_url_options = {host: 'localhost', port: 7000}
6461

6562
# Print deprecation notices to the Rails logger.
@@ -77,6 +74,9 @@
7774
# Highlight code that triggered database queries in logs.
7875
config.active_record.verbose_query_logs = true
7976

77+
# Append comments with runtime information tags to SQL queries in logs.
78+
config.active_record.query_log_tags_enabled = true
79+
8080
# Highlight code that enqueued background job in logs.
8181
config.active_job.verbose_enqueue_logs = true
8282

0 commit comments

Comments
 (0)