Skip to content

Commit 030b5c2

Browse files
committed
Upgrade to Rails 8.0 and apply new framework defaults
* Remove outdated pry-byebug and pry-rails gems
1 parent e2231d7 commit 030b5c2

23 files changed

+752
-456
lines changed

Gemfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ gem 'nokogiri'
2929
gem 'pg'
3030
gem 'proformaxml', '~> 1.5.1'
3131
gem 'puma'
32-
gem 'rails', '~> 7.2.2'
32+
gem 'rails', '~> 8.0.0'
3333
gem 'rails_admin'
3434
gem 'rails-html-sanitizer'
3535
gem 'rails-i18n'
@@ -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: 59 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,69 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
actioncable (7.2.2)
5-
actionpack (= 7.2.2)
6-
activesupport (= 7.2.2)
4+
actioncable (8.0.0)
5+
actionpack (= 8.0.0)
6+
activesupport (= 8.0.0)
77
nio4r (~> 2.0)
88
websocket-driver (>= 0.6.1)
99
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)
10+
actionmailbox (8.0.0)
11+
actionpack (= 8.0.0)
12+
activejob (= 8.0.0)
13+
activerecord (= 8.0.0)
14+
activestorage (= 8.0.0)
15+
activesupport (= 8.0.0)
1616
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)
17+
actionmailer (8.0.0)
18+
actionpack (= 8.0.0)
19+
actionview (= 8.0.0)
20+
activejob (= 8.0.0)
21+
activesupport (= 8.0.0)
2222
mail (>= 2.8.0)
2323
rails-dom-testing (~> 2.2)
24-
actionpack (7.2.2)
25-
actionview (= 7.2.2)
26-
activesupport (= 7.2.2)
24+
actionpack (8.0.0)
25+
actionview (= 8.0.0)
26+
activesupport (= 8.0.0)
2727
nokogiri (>= 1.8.5)
28-
racc
29-
rack (>= 2.2.4, < 3.2)
28+
rack (>= 2.2.4)
3029
rack-session (>= 1.0.1)
3130
rack-test (>= 0.6.3)
3231
rails-dom-testing (~> 2.2)
3332
rails-html-sanitizer (~> 1.6)
3433
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)
34+
actiontext (8.0.0)
35+
actionpack (= 8.0.0)
36+
activerecord (= 8.0.0)
37+
activestorage (= 8.0.0)
38+
activesupport (= 8.0.0)
4039
globalid (>= 0.6.0)
4140
nokogiri (>= 1.8.5)
42-
actionview (7.2.2)
43-
activesupport (= 7.2.2)
41+
actionview (8.0.0)
42+
activesupport (= 8.0.0)
4443
builder (~> 3.1)
4544
erubi (~> 1.11)
4645
rails-dom-testing (~> 2.2)
4746
rails-html-sanitizer (~> 1.6)
48-
activejob (7.2.2)
49-
activesupport (= 7.2.2)
47+
activejob (8.0.0)
48+
activesupport (= 8.0.0)
5049
globalid (>= 0.3.6)
51-
activemodel (7.2.2)
52-
activesupport (= 7.2.2)
50+
activemodel (8.0.0)
51+
activesupport (= 8.0.0)
5352
activemodel-serializers-xml (1.0.3)
5453
activemodel (>= 5.0.0.a)
5554
activesupport (>= 5.0.0.a)
5655
builder (~> 3.1)
57-
activerecord (7.2.2)
58-
activemodel (= 7.2.2)
59-
activesupport (= 7.2.2)
56+
activerecord (8.0.0)
57+
activemodel (= 8.0.0)
58+
activesupport (= 8.0.0)
6059
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)
60+
activestorage (8.0.0)
61+
actionpack (= 8.0.0)
62+
activejob (= 8.0.0)
63+
activerecord (= 8.0.0)
64+
activesupport (= 8.0.0)
6665
marcel (~> 1.0)
67-
activesupport (7.2.2)
66+
activesupport (8.0.0)
6867
base64
6968
benchmark (>= 0.3)
7069
bigdecimal
@@ -76,6 +75,7 @@ GEM
7675
minitest (>= 5.1)
7776
securerandom (>= 0.3)
7877
tzinfo (~> 2.0, >= 2.0.5)
78+
uri (>= 0.13.1)
7979
acts-as-taggable-on (12.0.0)
8080
activerecord (>= 7.1, < 8.1)
8181
zeitwerk (>= 2.4, < 3.0)
@@ -104,7 +104,6 @@ GEM
104104
bunny (2.23.0)
105105
amq-protocol (~> 2.3, >= 2.3.1)
106106
sorted_set (~> 1, >= 1.0.2)
107-
byebug (11.1.3)
108107
capybara (3.40.0)
109108
addressable
110109
matrix
@@ -118,7 +117,6 @@ GEM
118117
logger (~> 1.5)
119118
chronic (0.10.2)
120119
chunky_png (1.4.0)
121-
coderay (1.1.3)
122120
coffee-rails (5.0.0)
123121
coffee-script (>= 2.2.0)
124122
railties (>= 5.2.0)
@@ -258,7 +256,6 @@ GEM
258256
net-smtp
259257
marcel (1.0.4)
260258
matrix (0.4.2)
261-
method_source (1.1.0)
262259
mini_magick (4.13.2)
263260
mini_mime (1.1.5)
264261
mini_portile2 (2.8.8)
@@ -312,14 +309,6 @@ GEM
312309
dachsfisch (~> 1.0.0)
313310
nokogiri (>= 1.10.2, < 2.0.0)
314311
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)
323312
psych (5.2.1)
324313
date
325314
stringio
@@ -350,20 +339,20 @@ GEM
350339
rack (>= 1.3)
351340
rackup (2.2.1)
352341
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)
342+
rails (8.0.0)
343+
actioncable (= 8.0.0)
344+
actionmailbox (= 8.0.0)
345+
actionmailer (= 8.0.0)
346+
actionpack (= 8.0.0)
347+
actiontext (= 8.0.0)
348+
actionview (= 8.0.0)
349+
activejob (= 8.0.0)
350+
activemodel (= 8.0.0)
351+
activerecord (= 8.0.0)
352+
activestorage (= 8.0.0)
353+
activesupport (= 8.0.0)
365354
bundler (>= 1.15.0)
366-
railties (= 7.2.2)
355+
railties (= 8.0.0)
367356
rails-controller-testing (1.0.5)
368357
actionpack (>= 5.0.1.rc1)
369358
actionview (>= 5.0.1.rc1)
@@ -375,19 +364,19 @@ GEM
375364
rails-html-sanitizer (1.6.1)
376365
loofah (~> 2.21)
377366
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)
367+
rails-i18n (8.0.1)
379368
i18n (>= 0.7, < 2)
380-
railties (>= 6.0.0, < 8)
369+
railties (>= 8.0.0, < 9)
381370
rails_admin (3.3.0)
382371
activemodel-serializers-xml (>= 1.0)
383372
csv
384373
kaminari (>= 0.14, < 2.0)
385374
nested_form (~> 0.3)
386375
rails (>= 6.0, < 9)
387376
turbo-rails (>= 1.0, < 3)
388-
railties (7.2.2)
389-
actionpack (= 7.2.2)
390-
activesupport (= 7.2.2)
377+
railties (8.0.0)
378+
actionpack (= 8.0.0)
379+
activesupport (= 8.0.0)
391380
irb (~> 1.13)
392381
rackup (>= 1.0.0)
393382
rake (>= 12.2)
@@ -543,7 +532,7 @@ GEM
543532
fugit (~> 1.11.0)
544533
railties (>= 7.1)
545534
thor (~> 1.3.1)
546-
sorbet-runtime (0.5.11685)
535+
sorbet-runtime (0.5.11690)
547536
sorted_set (1.0.3)
548537
rbtree
549538
set (~> 1.0)
@@ -640,13 +629,11 @@ DEPENDENCIES
640629
omniauth-saml (~> 2.2)
641630
pg
642631
proformaxml (~> 1.5.1)
643-
pry-byebug
644-
pry-rails
645632
puma
646633
pundit
647634
pundit-matchers
648635
rack-mini-profiler
649-
rails (~> 7.2.2)
636+
rails (~> 8.0.0)
650637
rails-controller-testing
651638
rails-html-sanitizer
652639
rails-i18n

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)