Skip to content

Commit 73a160f

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 d106348 commit 73a160f

22 files changed

+738
-408
lines changed

Gemfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ gem 'proformaxml', '~> 1.5.1'
3636
gem 'prometheus_exporter'
3737
gem 'puma'
3838
gem 'pundit'
39-
gem 'rails', '~> 7.2.2'
40-
gem 'rails_admin'
41-
gem 'rails-i18n'
39+
gem 'rails', '~> 8.0.0'
40+
gem 'rails_admin', github: 'jewilmeer/rails_admin', branch: 'rails-8'
41+
gem 'rails-i18n', github: 'Shopify/rails-i18n', branch: 'schwad_rails_8'
4242
gem 'rails-timeago'
4343
gem 'ransack'
4444
gem 'rubytree'

Gemfile.lock

Lines changed: 80 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
GIT
2+
remote: https://github.com/Shopify/rails-i18n.git
3+
revision: 96778ff0651365a08db1b88aba486b844a0ac3e7
4+
branch: schwad_rails_8
5+
specs:
6+
rails-i18n (7.0.9)
7+
i18n (>= 0.7, < 2)
8+
railties (>= 6.0.0)
9+
10+
GIT
11+
remote: https://github.com/jewilmeer/rails_admin.git
12+
revision: a7f418b975cfad0ba684aa1d821d32f2b80544de
13+
branch: rails-8
14+
specs:
15+
rails_admin (3.2.1)
16+
activemodel-serializers-xml (>= 1.0)
17+
csv
18+
kaminari (>= 0.14, < 2.0)
19+
nested_form (~> 0.3)
20+
rails (>= 6.0, < 9)
21+
turbo-rails (>= 1.0, < 3)
22+
123
GIT
224
remote: https://github.com/openhpi/tubesock.git
325
revision: a7157067b28f7a70dcf100eac227b8d7f7628883
@@ -9,70 +31,69 @@ GIT
931
GEM
1032
remote: https://rubygems.org/
1133
specs:
12-
actioncable (7.2.2)
13-
actionpack (= 7.2.2)
14-
activesupport (= 7.2.2)
34+
actioncable (8.0.0)
35+
actionpack (= 8.0.0)
36+
activesupport (= 8.0.0)
1537
nio4r (~> 2.0)
1638
websocket-driver (>= 0.6.1)
1739
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)
40+
actionmailbox (8.0.0)
41+
actionpack (= 8.0.0)
42+
activejob (= 8.0.0)
43+
activerecord (= 8.0.0)
44+
activestorage (= 8.0.0)
45+
activesupport (= 8.0.0)
2446
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)
47+
actionmailer (8.0.0)
48+
actionpack (= 8.0.0)
49+
actionview (= 8.0.0)
50+
activejob (= 8.0.0)
51+
activesupport (= 8.0.0)
3052
mail (>= 2.8.0)
3153
rails-dom-testing (~> 2.2)
32-
actionpack (7.2.2)
33-
actionview (= 7.2.2)
34-
activesupport (= 7.2.2)
54+
actionpack (8.0.0)
55+
actionview (= 8.0.0)
56+
activesupport (= 8.0.0)
3557
nokogiri (>= 1.8.5)
36-
racc
37-
rack (>= 2.2.4, < 3.2)
58+
rack (>= 2.2.4)
3859
rack-session (>= 1.0.1)
3960
rack-test (>= 0.6.3)
4061
rails-dom-testing (~> 2.2)
4162
rails-html-sanitizer (~> 1.6)
4263
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)
64+
actiontext (8.0.0)
65+
actionpack (= 8.0.0)
66+
activerecord (= 8.0.0)
67+
activestorage (= 8.0.0)
68+
activesupport (= 8.0.0)
4869
globalid (>= 0.6.0)
4970
nokogiri (>= 1.8.5)
50-
actionview (7.2.2)
51-
activesupport (= 7.2.2)
71+
actionview (8.0.0)
72+
activesupport (= 8.0.0)
5273
builder (~> 3.1)
5374
erubi (~> 1.11)
5475
rails-dom-testing (~> 2.2)
5576
rails-html-sanitizer (~> 1.6)
56-
activejob (7.2.2)
57-
activesupport (= 7.2.2)
77+
activejob (8.0.0)
78+
activesupport (= 8.0.0)
5879
globalid (>= 0.3.6)
59-
activemodel (7.2.2)
60-
activesupport (= 7.2.2)
80+
activemodel (8.0.0)
81+
activesupport (= 8.0.0)
6182
activemodel-serializers-xml (1.0.3)
6283
activemodel (>= 5.0.0.a)
6384
activesupport (>= 5.0.0.a)
6485
builder (~> 3.1)
65-
activerecord (7.2.2)
66-
activemodel (= 7.2.2)
67-
activesupport (= 7.2.2)
86+
activerecord (8.0.0)
87+
activemodel (= 8.0.0)
88+
activesupport (= 8.0.0)
6889
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)
90+
activestorage (8.0.0)
91+
actionpack (= 8.0.0)
92+
activejob (= 8.0.0)
93+
activerecord (= 8.0.0)
94+
activesupport (= 8.0.0)
7495
marcel (~> 1.0)
75-
activesupport (7.2.2)
96+
activesupport (8.0.0)
7697
base64
7798
benchmark (>= 0.3)
7899
bigdecimal
@@ -84,6 +105,7 @@ GEM
84105
minitest (>= 5.1)
85106
securerandom (>= 0.3)
86107
tzinfo (~> 2.0, >= 2.0.5)
108+
uri (>= 0.13.1)
87109
addressable (2.8.7)
88110
public_suffix (>= 2.0.2, < 7.0)
89111
amq-protocol (2.3.2)
@@ -349,20 +371,20 @@ GEM
349371
rack (>= 1.3)
350372
rackup (2.2.0)
351373
rack (>= 3)
352-
rails (7.2.2)
353-
actioncable (= 7.2.2)
354-
actionmailbox (= 7.2.2)
355-
actionmailer (= 7.2.2)
356-
actionpack (= 7.2.2)
357-
actiontext (= 7.2.2)
358-
actionview (= 7.2.2)
359-
activejob (= 7.2.2)
360-
activemodel (= 7.2.2)
361-
activerecord (= 7.2.2)
362-
activestorage (= 7.2.2)
363-
activesupport (= 7.2.2)
374+
rails (8.0.0)
375+
actioncable (= 8.0.0)
376+
actionmailbox (= 8.0.0)
377+
actionmailer (= 8.0.0)
378+
actionpack (= 8.0.0)
379+
actiontext (= 8.0.0)
380+
actionview (= 8.0.0)
381+
activejob (= 8.0.0)
382+
activemodel (= 8.0.0)
383+
activerecord (= 8.0.0)
384+
activestorage (= 8.0.0)
385+
activesupport (= 8.0.0)
364386
bundler (>= 1.15.0)
365-
railties (= 7.2.2)
387+
railties (= 8.0.0)
366388
rails-controller-testing (1.0.5)
367389
actionpack (>= 5.0.1.rc1)
368390
actionview (>= 5.0.1.rc1)
@@ -374,22 +396,12 @@ GEM
374396
rails-html-sanitizer (1.6.0)
375397
loofah (~> 2.21)
376398
nokogiri (~> 1.14)
377-
rails-i18n (7.0.10)
378-
i18n (>= 0.7, < 2)
379-
railties (>= 6.0.0, < 8)
380399
rails-timeago (2.20.0)
381400
actionpack (>= 5.2)
382401
activesupport (>= 5.2)
383-
rails_admin (3.2.1)
384-
activemodel-serializers-xml (>= 1.0)
385-
csv
386-
kaminari (>= 0.14, < 2.0)
387-
nested_form (~> 0.3)
388-
rails (>= 6.0, < 8)
389-
turbo-rails (>= 1.0, < 3)
390-
railties (7.2.2)
391-
actionpack (= 7.2.2)
392-
activesupport (= 7.2.2)
402+
railties (8.0.0)
403+
actionpack (= 8.0.0)
404+
activesupport (= 8.0.0)
393405
irb (~> 1.13)
394406
rackup (>= 1.0.0)
395407
rake (>= 12.2)
@@ -643,11 +655,11 @@ DEPENDENCIES
643655
puma
644656
pundit
645657
rack-mini-profiler
646-
rails (~> 7.2.2)
658+
rails (~> 8.0.0)
647659
rails-controller-testing
648-
rails-i18n
660+
rails-i18n!
649661
rails-timeago
650-
rails_admin
662+
rails_admin!
651663
ransack
652664
rspec-collection_matchers
653665
rspec-github

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/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)