はじめに
Rails 5 系の最終である 5.2 です。
Rails のアップデート
まず、Gemfile の rails を5.2 の最終である 5.2.4.4 に変更します。
gem 'rails', '5.2.4.4'
bundle update します。
bundle update
app:update もしておきます。
env THOR_DIFF=vimdiff bin/rake app:update
bootsnap gem の追加
bin/rails server をしてみると LoadError が起こりました。
hkob@dockerhost /o/webcitc> bin/rails server /opt/webcitc/config/boot.rb:4:in `require': cannot load such file -- bootsnap/setup (LoadError)
bootsnap を Gemfile に追加する必要があるようです → bootsnapのせいでRails5.2とかが動かない人へ - Qiita
halt_callback_chains_on_return_false の削除
initializers/new_framework_defaults* にアップデートの際に前のバージョンの設定を引き継ぐ設定などが残されています。これらはとりあえず手を付けずにいたのですが、この部分でエラーが出てしまいました既存のアプリのRailsのバージョンをあげた際にrails sが立ち上がらない - Qiita を確認すると、「Rails 4との後方互換のためのメソッド」とのこと。とりあえずこの部分を削除してみます。
/opt/webcitc/config/initializers/new_framework_defaults.rb:23:in `<top (required)>': undefined method `halt_callback_chains_on_return_false=' for ActiveSupport:Module (NoMethodError)
action_dispatch の修正
再度、bin/rails server してみましたが、また「&.」にやられました。Ruby 2.2.2 で動くと言いながら、実際に動かないパターンです。Ruby のバージョンを上げてしまった方が早い気がしますが、まずはテストの確認を先にします。
hkob@dockerhost /o/webcitc> bin/rails server => Booting Puma => Rails 5.2.4.4 application starting in development => Run `rails server -h` for more startup options Exiting /opt/webcitc/vendor/bundle/ruby/2.2.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require': /opt/webcitc/vendor/bundle/ruby/2.2.0/gems/actionpack-5.2.4.4/lib/action_disp atch/request/session.rb:96: syntax error, unexpected '.' (SyntaxError) id&.public_id ^
おわりに
あまり大きな修正をすることもなく、Rails 5.2 でテストが全て通りました。
Finished in 10 minutes 45 seconds (files took 8.48 seconds to load) 7725 examples, 0 failures, 98 pending
(12/29追記) Segmentation fault の原因が hpricot だとわかったので、 Ruby 2.5.1 でやり直してみました。あまり時間は変わりませんでした。
Finished in 11 minutes 4 seconds (files took 5.15 seconds to load) 7725 examples, 0 failures, 98 pending
gem の遷移はこんな感じになりました。
gem_name | ver5.1 | ver5.2 | changed |
---|---|---|---|
actioncable | 5.1.7 | 5.2.4.4 | ↑ |
actionmailer | 5.1.7 | 5.2.4.4 | ↑ |
actionpack | 5.1.7 | 5.2.4.4 | ↑ |
actionview | 5.1.7 | 5.2.4.4 | ↑ |
activejob | 5.1.7 | 5.2.4.4 | ↑ |
activemodel | 5.1.7 | 5.2.4.4 | ↑ |
activerecord | 5.1.7 | 5.2.4.4 | ↑ |
activestorage | 5.2.4.4 | + | |
activesupport | 5.1.7 | 5.2.4.4 | ↑ |
arel | 8.0.0 | 9.0.0 | ↑ |
bcrypt | 3.1.16 | 3.1.16 | = |
bindex | 0.8.1 | 0.8.1 | = |
bootsnap | 1.4.5 | + | |
builder | 3.2.4 | 3.2.4 | = |
choice | 0.2.0 | 0.2.0 | = |
coderay | 1.1.3 | 1.1.3 | = |
coffee-rails | 4.2.2 | 5.0.0 | ↑ |
coffee-script | 2.4.1 | 2.4.1 | = |
coffee-script-source | 1.12.2 | 1.12.2 | = |
concurrent-ruby | 1.1.7 | 1.1.7 | = |
crass | 1.0.6 | 1.0.6 | = |
database_cleaner | 1.8.5 | 1.8.5 | = |
devise | 4.7.3 | 4.7.3 | = |
devise-encryptable | 0.2.0 | 0.2.0 | = |
devise_ldap_authenticatable | 0.8.7 | 0.8.7 | = |
diff-lcs | 1.4.4 | 1.4.4 | = |
docile | 1.3.4 | 1.3.4 | = |
dotenv | 2.7.6 | 2.7.6 | = |
erubi | 1.10.0 | 1.10.0 | = |
erubis | 2.7.0 | 2.7.0 | = |
execjs | 2.7.0 | 2.7.0 | = |
factory_bot | 4.11.1 | 4.11.1 | = |
factory_bot_rails | 4.11.1 | 4.11.1 | = |
ffi | 1.12.2 | 1.12.2 | = |
formatador | 0.2.5 | 0.2.5 | = |
globalid | 0.4.2 | 0.4.2 | = |
guard | 2.16.2 | 2.16.2 | = |
guard-compat | 1.2.1 | 1.2.1 | = |
guard-rspec | 4.7.3 | 4.7.3 | = |
haml | 5.2.1 | 5.2.1 | = |
haml-rails | 1.0.0 | 1.0.0 | = |
hpricot | 0.8.6 | 0.8.6 | = |
html2haml | 2.2.0 | 2.2.0 | = |
i18n | 1.5.1 | 1.5.1 | = |
jquery-rails | 4.4.0 | 4.4.0 | = |
json | 2.5.1 | 2.5.1 | = |
kaminari | 1.2.1 | 1.2.1 | = |
kaminari-actionview | 1.2.1 | 1.2.1 | = |
kaminari-activerecord | 1.2.1 | 1.2.1 | = |
kaminari-core | 1.2.1 | 1.2.1 | = |
listen | 3.0.8 | 3.0.8 | = |
loofah | 2.8.0 | 2.8.0 | = |
lumberjack | 1.0.13 | 1.0.13 | = |
2.7.1 | 2.7.1 | = | |
marcel | 0.3.3 | + | |
method_source | 1.0.0 | 1.0.0 | = |
mimemagic | 0.3.5 | + | |
mini_mime | 1.0.2 | 1.0.2 | = |
mini_portile2 | 2.4.0 | 2.4.0 | = |
minitest | 5.14.2 | 5.14.2 | = |
msgpack | 1.3.3 | + | |
nenv | 0.3.0 | 0.3.0 | = |
net-ldap | 0.17.0 | 0.17.0 | = |
nio4r | 2.3.1 | 2.3.1 | = |
nokogiri | 1.9.1 | 1.9.1 | = |
notiffany | 0.1.3 | 0.1.3 | = |
orm_adapter | 0.5.0 | 0.5.0 | = |
pg | 1.2.3 | 1.2.3 | = |
power_assert | 1.2.0 | 1.2.0 | = |
pry | 0.13.1 | 0.13.1 | = |
puma | 5.1.1 | 5.1.1 | = |
rack | 2.1.4 | 2.1.4 | = |
rack-cache | 1.9.0 | 1.9.0 | = |
rack-test | 1.1.0 | 1.1.0 | = |
rails | 5.1.7 | 5.2.4.4 | ↑ |
rails-controller-testing | 1.0.5 | 1.0.5 | = |
rails-dom-testing | 2.0.3 | 2.0.3 | = |
rails-erd | 1.6.0 | 1.6.0 | = |
rails-html-sanitizer | 1.3.0 | 1.3.0 | = |
railties | 5.1.7 | 5.2.4.4 | ↑ |
rake | 13.0.3 | 13.0.3 | = |
rb-fsevent | 0.10.4 | 0.10.4 | = |
rb-inotify | 0.10.1 | 0.10.1 | = |
rdoc | 6.2.0 | 6.2.0 | = |
redcarpet | 3.5.1 | 3.5.1 | = |
responders | 2.4.1 | 2.4.1 | = |
rspec | 3.10.0 | 3.10.0 | = |
rspec-core | 3.10.1 | 3.10.1 | = |
rspec-expectations | 3.10.1 | 3.10.1 | = |
rspec-mocks | 3.10.0 | 3.10.0 | = |
rspec-rails | 4.0.2 | 4.0.2 | = |
rspec-support | 3.10.1 | 3.10.1 | = |
ruby-graphviz | 1.2.4 | 1.2.4 | = |
ruby_parser | 3.15.0 | 3.15.0 | = |
sassc | 2.4.0 | 2.4.0 | = |
sassc-rails | 2.1.2 | 2.1.2 | = |
sexp_processor | 4.15.1 | 4.15.1 | = |
shellany | 0.0.1 | 0.0.1 | = |
simplecov | 0.17.1 | 0.17.1 | = |
simplecov-html | 0.10.2 | 0.10.2 | = |
simplecov-rcov | 0.2.3 | 0.2.3 | = |
spring | 2.0.2 | 2.0.2 | = |
spring-commands-rspec | 1.0.4 | 1.0.4 | = |
spring-watcher-listen | 2.0.1 | 2.0.1 | = |
sprockets | 3.7.2 | 3.7.2 | = |
sprockets-rails | 3.2.2 | 3.2.2 | = |
temple | 0.8.2 | 0.8.2 | = |
test-unit | 3.3.8 | 3.3.8 | = |
thor | 1.0.1 | 1.0.1 | = |
thread_safe | 0.3.6 | 0.3.6 | = |
tilt | 2.0.10 | 2.0.10 | = |
tzinfo | 1.2.9 | 1.2.9 | = |
uglifier | 4.2.0 | 4.2.0 | = |
warden | 1.2.9 | 1.2.9 | = |
web-console | 3.7.0 | 3.7.0 | = |
websocket-driver | 0.6.5 | 0.7.3 | ↑ |
websocket-extensions | 0.1.5 | 0.1.5 | = |
yard | 0.9.26 | 0.9.26 | = |
yard-activerecord | 0.0.16 | 0.0.16 | = |