Skip to content

Commit abd35d1

Browse files
authored
Merge pull request #1692 from coderdojo-japan/upgrade-to-rails-7-2
Upgrade Ruby on Rails: 7.1 -> 7.2
2 parents 527dd74 + 0453daf commit abd35d1

20 files changed

+456
-183
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ gem 'bootsnap'
55
gem 'pg'
66
gem 'puma'
77
gem 'puma_worker_killer'
8-
gem 'rails', '~> 7.1.5'
8+
gem 'rails', '~> 7.2.0'
99

1010
gem 'jbuilder'
1111
gem 'jquery-rails'

Gemfile.lock

Lines changed: 62 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,77 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
actioncable (7.1.5.1)
5-
actionpack (= 7.1.5.1)
6-
activesupport (= 7.1.5.1)
4+
actioncable (7.2.2.1)
5+
actionpack (= 7.2.2.1)
6+
activesupport (= 7.2.2.1)
77
nio4r (~> 2.0)
88
websocket-driver (>= 0.6.1)
99
zeitwerk (~> 2.6)
10-
actionmailbox (7.1.5.1)
11-
actionpack (= 7.1.5.1)
12-
activejob (= 7.1.5.1)
13-
activerecord (= 7.1.5.1)
14-
activestorage (= 7.1.5.1)
15-
activesupport (= 7.1.5.1)
16-
mail (>= 2.7.1)
17-
net-imap
18-
net-pop
19-
net-smtp
20-
actionmailer (7.1.5.1)
21-
actionpack (= 7.1.5.1)
22-
actionview (= 7.1.5.1)
23-
activejob (= 7.1.5.1)
24-
activesupport (= 7.1.5.1)
25-
mail (~> 2.5, >= 2.5.4)
26-
net-imap
27-
net-pop
28-
net-smtp
10+
actionmailbox (7.2.2.1)
11+
actionpack (= 7.2.2.1)
12+
activejob (= 7.2.2.1)
13+
activerecord (= 7.2.2.1)
14+
activestorage (= 7.2.2.1)
15+
activesupport (= 7.2.2.1)
16+
mail (>= 2.8.0)
17+
actionmailer (7.2.2.1)
18+
actionpack (= 7.2.2.1)
19+
actionview (= 7.2.2.1)
20+
activejob (= 7.2.2.1)
21+
activesupport (= 7.2.2.1)
22+
mail (>= 2.8.0)
2923
rails-dom-testing (~> 2.2)
30-
actionpack (7.1.5.1)
31-
actionview (= 7.1.5.1)
32-
activesupport (= 7.1.5.1)
24+
actionpack (7.2.2.1)
25+
actionview (= 7.2.2.1)
26+
activesupport (= 7.2.2.1)
3327
nokogiri (>= 1.8.5)
3428
racc
35-
rack (>= 2.2.4)
29+
rack (>= 2.2.4, < 3.2)
3630
rack-session (>= 1.0.1)
3731
rack-test (>= 0.6.3)
3832
rails-dom-testing (~> 2.2)
3933
rails-html-sanitizer (~> 1.6)
40-
actiontext (7.1.5.1)
41-
actionpack (= 7.1.5.1)
42-
activerecord (= 7.1.5.1)
43-
activestorage (= 7.1.5.1)
44-
activesupport (= 7.1.5.1)
34+
useragent (~> 0.16)
35+
actiontext (7.2.2.1)
36+
actionpack (= 7.2.2.1)
37+
activerecord (= 7.2.2.1)
38+
activestorage (= 7.2.2.1)
39+
activesupport (= 7.2.2.1)
4540
globalid (>= 0.6.0)
4641
nokogiri (>= 1.8.5)
47-
actionview (7.1.5.1)
48-
activesupport (= 7.1.5.1)
42+
actionview (7.2.2.1)
43+
activesupport (= 7.2.2.1)
4944
builder (~> 3.1)
5045
erubi (~> 1.11)
5146
rails-dom-testing (~> 2.2)
5247
rails-html-sanitizer (~> 1.6)
53-
activejob (7.1.5.1)
54-
activesupport (= 7.1.5.1)
48+
activejob (7.2.2.1)
49+
activesupport (= 7.2.2.1)
5550
globalid (>= 0.3.6)
56-
activemodel (7.1.5.1)
57-
activesupport (= 7.1.5.1)
58-
activerecord (7.1.5.1)
59-
activemodel (= 7.1.5.1)
60-
activesupport (= 7.1.5.1)
51+
activemodel (7.2.2.1)
52+
activesupport (= 7.2.2.1)
53+
activerecord (7.2.2.1)
54+
activemodel (= 7.2.2.1)
55+
activesupport (= 7.2.2.1)
6156
timeout (>= 0.4.0)
62-
activestorage (7.1.5.1)
63-
actionpack (= 7.1.5.1)
64-
activejob (= 7.1.5.1)
65-
activerecord (= 7.1.5.1)
66-
activesupport (= 7.1.5.1)
57+
activestorage (7.2.2.1)
58+
actionpack (= 7.2.2.1)
59+
activejob (= 7.2.2.1)
60+
activerecord (= 7.2.2.1)
61+
activesupport (= 7.2.2.1)
6762
marcel (~> 1.0)
68-
activesupport (7.1.5.1)
63+
activesupport (7.2.2.1)
6964
base64
7065
benchmark (>= 0.3)
7166
bigdecimal
72-
concurrent-ruby (~> 1.0, >= 1.0.2)
67+
concurrent-ruby (~> 1.0, >= 1.3.1)
7368
connection_pool (>= 2.2.5)
7469
drb
7570
i18n (>= 1.6, < 2)
7671
logger (>= 1.4.2)
7772
minitest (>= 5.1)
78-
mutex_m
7973
securerandom (>= 0.3)
80-
tzinfo (~> 2.0)
74+
tzinfo (~> 2.0, >= 2.0.5)
8175
addressable (2.8.7)
8276
public_suffix (>= 2.0.2, < 7.0)
8377
airbrake (13.0.5)
@@ -348,20 +342,20 @@ GEM
348342
woothee (>= 1.0.0)
349343
rackup (2.2.1)
350344
rack (>= 3)
351-
rails (7.1.5.1)
352-
actioncable (= 7.1.5.1)
353-
actionmailbox (= 7.1.5.1)
354-
actionmailer (= 7.1.5.1)
355-
actionpack (= 7.1.5.1)
356-
actiontext (= 7.1.5.1)
357-
actionview (= 7.1.5.1)
358-
activejob (= 7.1.5.1)
359-
activemodel (= 7.1.5.1)
360-
activerecord (= 7.1.5.1)
361-
activestorage (= 7.1.5.1)
362-
activesupport (= 7.1.5.1)
345+
rails (7.2.2.1)
346+
actioncable (= 7.2.2.1)
347+
actionmailbox (= 7.2.2.1)
348+
actionmailer (= 7.2.2.1)
349+
actionpack (= 7.2.2.1)
350+
actiontext (= 7.2.2.1)
351+
actionview (= 7.2.2.1)
352+
activejob (= 7.2.2.1)
353+
activemodel (= 7.2.2.1)
354+
activerecord (= 7.2.2.1)
355+
activestorage (= 7.2.2.1)
356+
activesupport (= 7.2.2.1)
363357
bundler (>= 1.15.0)
364-
railties (= 7.1.5.1)
358+
railties (= 7.2.2.1)
365359
rails-controller-testing (1.0.5)
366360
actionpack (>= 5.0.1.rc1)
367361
actionview (>= 5.0.1.rc1)
@@ -373,10 +367,10 @@ GEM
373367
rails-html-sanitizer (1.6.2)
374368
loofah (~> 2.21)
375369
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)
376-
railties (7.1.5.1)
377-
actionpack (= 7.1.5.1)
378-
activesupport (= 7.1.5.1)
379-
irb
370+
railties (7.2.2.1)
371+
actionpack (= 7.2.2.1)
372+
activesupport (= 7.2.2.1)
373+
irb (~> 1.13)
380374
rackup (>= 1.0.0)
381375
rake (>= 12.2)
382376
thor (~> 1.0, >= 1.2.2)
@@ -512,6 +506,7 @@ GEM
512506
unicode-display_width (3.1.4)
513507
unicode-emoji (~> 4.0, >= 4.0.4)
514508
unicode-emoji (4.0.4)
509+
useragent (0.16.11)
515510
web-console (4.2.1)
516511
actionview (>= 6.0.0)
517512
activemodel (>= 6.0.0)
@@ -572,7 +567,7 @@ DEPENDENCIES
572567
rack-host-redirect
573568
rack-mini-profiler
574569
rack-user_agent
575-
rails (~> 7.1.5)
570+
rails (~> 7.2.0)
576571
rails-controller-testing
577572
rails-html-sanitizer
578573
rake

app/models/dojo_event_service.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class DojoEventService < ApplicationRecord
55
belongs_to :dojo
66
has_many :upcoming_events, dependent: :destroy
77

8-
enum name: EXTERNAL_SERVICES + INTERNAL_SERVICES
8+
enum :name, EXTERNAL_SERVICES + INTERNAL_SERVICES
99

1010
validates :name, presence: true
1111
validates :group_id, uniqueness: { scope: :name }, unless: Proc.new { |a| a.group_id.blank? }

bin/rubocop

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env ruby
2+
require "rubygems"
3+
require "bundler/setup"
4+
5+
# explicit rubocop config increases performance slightly while avoiding config confusion.
6+
ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
7+
8+
load Gem.bin_path("rubocop", "rubocop")

bin/setup

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,65 @@
11
#!/usr/bin/env ruby
22
require "fileutils"
3-
require 'date'
43

5-
# path to your application root.
6-
APP_ROOT = File.expand_path('..', __dir__)
4+
APP_ROOT = File.expand_path("..", __dir__)
5+
APP_NAME = "coderdojo-jp"
76

87
def system!(*args)
9-
system(*args) || abort("\n== Command #{args} failed ==")
10-
end
11-
12-
def doorkeeper_message
13-
<<~MESSAGE
14-
15-
環境変数 DOORKEEPER_API_TOKEN が設定されていないため、
16-
Doorkeeper API を使ったイベント情報の取得をスキップします。
17-
18-
Doorkeeper のイベントを取得するためには、
19-
下記ページから Doorkeeper API Token を取得し、
20-
環境変数 DOORKEEPER_API_TOKEN に設定してください。
21-
https://manage.doorkeeper.jp/user/oauth/applications
22-
23-
環境変数設定後に、bin/setup を再実行してください!
24-
25-
MESSAGE
8+
system(*args, exception: true)
269
end
2710

2811
FileUtils.chdir APP_ROOT do
2912
# This script is a way to set up or update your development environment automatically.
3013
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
3114
# Add necessary setup steps to this file.
3215

33-
puts '== Installing dependencies =='
34-
system! 'gem install bundler --conservative'
35-
system('bundle check') || system!('bundle install')
16+
puts "== Installing dependencies =="
17+
system! "gem install bundler --conservative"
18+
system("bundle check") || system!("bundle install")
3619

3720
# puts "\n== Copying sample files =="
38-
# unless File.exist?('config/database.yml')
39-
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml"
21+
# unless File.exist?("config/database.yml")
22+
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
4023
# end
4124

4225
puts "\n== Preparing database =="
43-
system! 'bin/rails db:prepare'
26+
system! "bin/rails db:prepare"
4427

4528
puts "\n== Upserting application data =="
4629
system! 'bin/rails dojos:update_db_by_yaml'
4730
system! 'bin/rails dojo_event_services:upsert'
48-
49-
today = Date.today
50-
from = (today - 90).strftime('%Y%m')
51-
to = today.prev_month.strftime('%Y%m')
52-
53-
if ENV['DOORKEEPER_API_TOKEN']
54-
system! "bin/rails statistics:aggregation[#{from},#{to}]"
55-
system! 'bin/rails upcoming_events:aggregation'
56-
else
57-
puts doorkeeper_message
58-
system! "bin/rails statistics:aggregation[#{from},#{to},connpass]"
59-
system! "bin/rails statistics:aggregation[#{from},#{to},facebook]"
60-
system! 'bin/rails upcoming_events:aggregation[connpass]'
61-
end
31+
system! "bin/rails statistics:aggregation[-,-,static_yaml]"
32+
33+
# TODO: This would be better to move outside bin/setup. 'static_yaml' is enough fine.
34+
#
35+
#require "active_support/time"
36+
#today = Time.now.in_time_zone('Tokyo').to_date
37+
#from = (today - 90).strftime('%Y%m')
38+
#to = today.prev_month.strftime('%Y%m')
39+
#if ENV['DOORKEEPER_API_TOKEN'] && ENV['FIXIE_URL']
40+
# system! "bin/rails statistics:aggregation[#{from},#{to}]"
41+
# system! 'bin/rails upcoming_events:aggregation'
42+
#elsif ENV['DOORKEEPER_API_TOKEN']
43+
# system! "bin/rails statistics:aggregation[#{from},#{to},connpass]"
44+
# system! "bin/rails statistics:aggregation[#{from},#{to},facebook]"
45+
# system! 'bin/rails upcoming_events:aggregation[connpass]'
46+
#else
47+
# puts <<~MESSAGE
48+
# 環境変数 DOORKEEPER_API_TOKEN と FIXIE_URL が設定されていないため、
49+
# Doorkeeper API や connpass API を使ったイベント情報の取得をスキップします。
50+
#
51+
# なお API 経由でイベント情報を取得しなくても、rails server は実行可能です。
52+
# もし API 経由でイベント情報を取得したい場合は開発チームにご連絡ください。
53+
# MESSAGE
54+
#end
6255

6356
puts "\n== Removing old logs and tempfiles =="
64-
system! 'bin/rails log:clear tmp:clear'
57+
system! "bin/rails log:clear tmp:clear"
6558

6659
puts "\n== Restarting application server =="
67-
system! 'bin/rails restart'
60+
system! "bin/rails restart"
61+
62+
# puts "\n== Configuring puma-dev =="
63+
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
64+
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
6865
end

config/application.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,12 @@
99
module CoderdojoJp
1010
class Application < Rails::Application
1111
# Initialize configuration defaults for originally generated Rails version.
12-
# Each version's default can be checked at `config/initializers/new_framework_defaults_*.rb`
13-
config.load_defaults 7.1
14-
15-
# パフォーマンス最適化: autoloadパスを$LOAD_PATHに追加しない
16-
config.add_autoload_paths_to_load_path = false
12+
config.load_defaults 7.2
1713

1814
# Please, add to the `ignore` list any other `lib` subdirectories that do
1915
# not contain `.rb` files, or that should not be reloaded or eager loaded.
2016
# Common ones are `templates`, `generators`, or `middleware`, for example.
21-
config.autoload_lib(ignore: %w(assets tasks))
17+
config.autoload_lib(ignore: %w[assets tasks])
2218

2319
# Configuration for the application, engines, and railties goes here.
2420
#

0 commit comments

Comments
 (0)