Skip to content

Commit b6b1348

Browse files
committed
Upgrade to Rails 8.0 and apply new framework defaults
1 parent 6e8a77c commit b6b1348

File tree

21 files changed

+717
-417
lines changed

21 files changed

+717
-417
lines changed

Gemfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ gem 'nokogiri'
2929
gem 'pg'
3030
gem 'proformaxml', '~> 1.5.1'
3131
gem 'puma'
32-
gem 'rails', '~> 7.2.2'
33-
gem 'rails_admin'
32+
gem 'rails', '~> 8.0.0'
33+
gem 'rails_admin', github: 'railsadminteam/rails_admin'
3434
gem 'rails-html-sanitizer'
3535
gem 'rails-i18n'
3636
gem 'ransack'
@@ -70,8 +70,6 @@ group :development do
7070
gem 'i18n-tasks'
7171
gem 'letter_opener'
7272
gem 'listen'
73-
gem 'pry-byebug'
74-
gem 'pry-rails'
7573
gem 'rack-mini-profiler'
7674
gem 'rubocop'
7775
gem 'rubocop-capybara'

Gemfile.lock

Lines changed: 71 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,81 @@
1+
GIT
2+
remote: https://github.com/railsadminteam/rails_admin.git
3+
revision: e38c12d98e3e11b858d2f3caa752013b7478f926
4+
specs:
5+
rails_admin (3.2.1)
6+
activemodel-serializers-xml (>= 1.0)
7+
csv
8+
kaminari (>= 0.14, < 2.0)
9+
nested_form (~> 0.3)
10+
rails (>= 6.0, < 9)
11+
turbo-rails (>= 1.0, < 3)
12+
113
GEM
214
remote: https://rubygems.org/
315
specs:
4-
actioncable (7.2.2)
5-
actionpack (= 7.2.2)
6-
activesupport (= 7.2.2)
16+
actioncable (8.0.0)
17+
actionpack (= 8.0.0)
18+
activesupport (= 8.0.0)
719
nio4r (~> 2.0)
820
websocket-driver (>= 0.6.1)
921
zeitwerk (~> 2.6)
10-
actionmailbox (7.2.2)
11-
actionpack (= 7.2.2)
12-
activejob (= 7.2.2)
13-
activerecord (= 7.2.2)
14-
activestorage (= 7.2.2)
15-
activesupport (= 7.2.2)
22+
actionmailbox (8.0.0)
23+
actionpack (= 8.0.0)
24+
activejob (= 8.0.0)
25+
activerecord (= 8.0.0)
26+
activestorage (= 8.0.0)
27+
activesupport (= 8.0.0)
1628
mail (>= 2.8.0)
17-
actionmailer (7.2.2)
18-
actionpack (= 7.2.2)
19-
actionview (= 7.2.2)
20-
activejob (= 7.2.2)
21-
activesupport (= 7.2.2)
29+
actionmailer (8.0.0)
30+
actionpack (= 8.0.0)
31+
actionview (= 8.0.0)
32+
activejob (= 8.0.0)
33+
activesupport (= 8.0.0)
2234
mail (>= 2.8.0)
2335
rails-dom-testing (~> 2.2)
24-
actionpack (7.2.2)
25-
actionview (= 7.2.2)
26-
activesupport (= 7.2.2)
36+
actionpack (8.0.0)
37+
actionview (= 8.0.0)
38+
activesupport (= 8.0.0)
2739
nokogiri (>= 1.8.5)
28-
racc
29-
rack (>= 2.2.4, < 3.2)
40+
rack (>= 2.2.4)
3041
rack-session (>= 1.0.1)
3142
rack-test (>= 0.6.3)
3243
rails-dom-testing (~> 2.2)
3344
rails-html-sanitizer (~> 1.6)
3445
useragent (~> 0.16)
35-
actiontext (7.2.2)
36-
actionpack (= 7.2.2)
37-
activerecord (= 7.2.2)
38-
activestorage (= 7.2.2)
39-
activesupport (= 7.2.2)
46+
actiontext (8.0.0)
47+
actionpack (= 8.0.0)
48+
activerecord (= 8.0.0)
49+
activestorage (= 8.0.0)
50+
activesupport (= 8.0.0)
4051
globalid (>= 0.6.0)
4152
nokogiri (>= 1.8.5)
42-
actionview (7.2.2)
43-
activesupport (= 7.2.2)
53+
actionview (8.0.0)
54+
activesupport (= 8.0.0)
4455
builder (~> 3.1)
4556
erubi (~> 1.11)
4657
rails-dom-testing (~> 2.2)
4758
rails-html-sanitizer (~> 1.6)
48-
activejob (7.2.2)
49-
activesupport (= 7.2.2)
59+
activejob (8.0.0)
60+
activesupport (= 8.0.0)
5061
globalid (>= 0.3.6)
51-
activemodel (7.2.2)
52-
activesupport (= 7.2.2)
62+
activemodel (8.0.0)
63+
activesupport (= 8.0.0)
5364
activemodel-serializers-xml (1.0.3)
5465
activemodel (>= 5.0.0.a)
5566
activesupport (>= 5.0.0.a)
5667
builder (~> 3.1)
57-
activerecord (7.2.2)
58-
activemodel (= 7.2.2)
59-
activesupport (= 7.2.2)
68+
activerecord (8.0.0)
69+
activemodel (= 8.0.0)
70+
activesupport (= 8.0.0)
6071
timeout (>= 0.4.0)
61-
activestorage (7.2.2)
62-
actionpack (= 7.2.2)
63-
activejob (= 7.2.2)
64-
activerecord (= 7.2.2)
65-
activesupport (= 7.2.2)
72+
activestorage (8.0.0)
73+
actionpack (= 8.0.0)
74+
activejob (= 8.0.0)
75+
activerecord (= 8.0.0)
76+
activesupport (= 8.0.0)
6677
marcel (~> 1.0)
67-
activesupport (7.2.2)
78+
activesupport (8.0.0)
6879
base64
6980
benchmark (>= 0.3)
7081
bigdecimal
@@ -76,6 +87,7 @@ GEM
7687
minitest (>= 5.1)
7788
securerandom (>= 0.3)
7889
tzinfo (~> 2.0, >= 2.0.5)
90+
uri (>= 0.13.1)
7991
acts-as-taggable-on (12.0.0)
8092
activerecord (>= 7.1, < 8.1)
8193
zeitwerk (>= 2.4, < 3.0)
@@ -104,7 +116,6 @@ GEM
104116
bunny (2.23.0)
105117
amq-protocol (~> 2.3, >= 2.3.1)
106118
sorted_set (~> 1, >= 1.0.2)
107-
byebug (11.1.3)
108119
capybara (3.40.0)
109120
addressable
110121
matrix
@@ -118,7 +129,6 @@ GEM
118129
logger (~> 1.5)
119130
chronic (0.10.2)
120131
chunky_png (1.4.0)
121-
coderay (1.1.3)
122132
coffee-rails (5.0.0)
123133
coffee-script (>= 2.2.0)
124134
railties (>= 5.2.0)
@@ -258,7 +268,6 @@ GEM
258268
net-smtp
259269
marcel (1.0.4)
260270
matrix (0.4.2)
261-
method_source (1.1.0)
262271
mini_magick (4.13.2)
263272
mini_mime (1.1.5)
264273
mini_portile2 (2.8.8)
@@ -312,14 +321,6 @@ GEM
312321
dachsfisch (~> 1.0.0)
313322
nokogiri (>= 1.10.2, < 2.0.0)
314323
rubyzip (>= 1.2.2, < 3.0.0)
315-
pry (0.14.2)
316-
coderay (~> 1.1)
317-
method_source (~> 1.0)
318-
pry-byebug (3.10.1)
319-
byebug (~> 11.0)
320-
pry (>= 0.13, < 0.15)
321-
pry-rails (0.3.11)
322-
pry (>= 0.13.0)
323324
psych (5.2.1)
324325
date
325326
stringio
@@ -350,20 +351,20 @@ GEM
350351
rack (>= 1.3)
351352
rackup (2.2.1)
352353
rack (>= 3)
353-
rails (7.2.2)
354-
actioncable (= 7.2.2)
355-
actionmailbox (= 7.2.2)
356-
actionmailer (= 7.2.2)
357-
actionpack (= 7.2.2)
358-
actiontext (= 7.2.2)
359-
actionview (= 7.2.2)
360-
activejob (= 7.2.2)
361-
activemodel (= 7.2.2)
362-
activerecord (= 7.2.2)
363-
activestorage (= 7.2.2)
364-
activesupport (= 7.2.2)
354+
rails (8.0.0)
355+
actioncable (= 8.0.0)
356+
actionmailbox (= 8.0.0)
357+
actionmailer (= 8.0.0)
358+
actionpack (= 8.0.0)
359+
actiontext (= 8.0.0)
360+
actionview (= 8.0.0)
361+
activejob (= 8.0.0)
362+
activemodel (= 8.0.0)
363+
activerecord (= 8.0.0)
364+
activestorage (= 8.0.0)
365+
activesupport (= 8.0.0)
365366
bundler (>= 1.15.0)
366-
railties (= 7.2.2)
367+
railties (= 8.0.0)
367368
rails-controller-testing (1.0.5)
368369
actionpack (>= 5.0.1.rc1)
369370
actionview (>= 5.0.1.rc1)
@@ -375,19 +376,12 @@ GEM
375376
rails-html-sanitizer (1.6.1)
376377
loofah (~> 2.21)
377378
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)
378-
rails-i18n (7.0.10)
379+
rails-i18n (8.0.1)
379380
i18n (>= 0.7, < 2)
380-
railties (>= 6.0.0, < 8)
381-
rails_admin (3.2.1)
382-
activemodel-serializers-xml (>= 1.0)
383-
csv
384-
kaminari (>= 0.14, < 2.0)
385-
nested_form (~> 0.3)
386-
rails (>= 6.0, < 8)
387-
turbo-rails (>= 1.0, < 3)
388-
railties (7.2.2)
389-
actionpack (= 7.2.2)
390-
activesupport (= 7.2.2)
381+
railties (>= 8.0.0, < 9)
382+
railties (8.0.0)
383+
actionpack (= 8.0.0)
384+
activesupport (= 8.0.0)
391385
irb (~> 1.13)
392386
rackup (>= 1.0.0)
393387
rake (>= 12.2)
@@ -640,17 +634,15 @@ DEPENDENCIES
640634
omniauth-saml (~> 2.2)
641635
pg
642636
proformaxml (~> 1.5.1)
643-
pry-byebug
644-
pry-rails
645637
puma
646638
pundit
647639
pundit-matchers
648640
rack-mini-profiler
649-
rails (~> 7.2.2)
641+
rails (~> 8.0.0)
650642
rails-controller-testing
651643
rails-html-sanitizer
652644
rails-i18n
653-
rails_admin
645+
rails_admin!
654646
ransack
655647
rqrcode
656648
rspec-collection_matchers

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 = 'codeharbor'
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
@@ -13,7 +13,7 @@
1313
module CodeHarbor
1414
class Application < Rails::Application
1515
# Initialize configuration defaults for originally generated Rails version.
16-
config.load_defaults 7.2
16+
config.load_defaults 8.0
1717

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

config/environments/development.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
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

2321
# Eager load code on boot.
@@ -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 = 'codeharbor_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: 7500}
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)