Slide 1

Slide 1 text

今、始める、第一歩。 Kaigi on Rails 2024事後勉強会 / Nov 8 2024 Yasuo Honda @yahonda

Slide 2

Slide 2 text

self ● Yasuo Honda / 本多康夫 ○ Rails committer ○ Maintainer of Active Record Oracle enhanced adapter ○ https://github.com/yahonda ○ https://x.com/yahonda ○ https://mastodon.social/@yahonda ● RailsのPull requestsのレビューの時に私が考えていること | Kaigi on Rails 2024 スピーカー

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

https://rubyonrails.org/2024/11/7/rals-8-no-paas-required

Slide 5

Slide 5 text

Ruby 3.4 : 2024年12月25日リリース予定 ● あと2ヶ月弱 ● Ruby 3.4.0 preview 2 : 2024年10月7日リリース ○ https://www.ruby-lang.org/en/news/2024/10/07/ruby-3-4 -0-preview2-released/

Slide 6

Slide 6 text

Rails 8.0のRuby 3.4対応状況 ● Rails本体と依存する(gemspecやGemfileに書いてある)gem ○ Ruby 3.4対応されている ○ 今後Ruby 3.4に変更が発生しても、アクティブなコントリビューター/ コミッターによりすぐ解決される ● あなたの第一歩をどこで始めるか

Slide 7

Slide 7 text

あなたが使っている Railsの3rd party gemの Ruby 3.4対応から始める $ rails new した後に、Gemfileに追加するgemのこと

Slide 8

Slide 8 text

1. Ruby 3.4.0 preview 2で Rails 8.0.0にしてみる

Slide 9

Slide 9 text

2. bundle updateしてみる うまくいきましたか?

Slide 10

Slide 10 text

Already fixed https://github.com/collectiveidea/audited/pull/729 バージョン “< 8.0”の例

Slide 11

Slide 11 text

3. add_dependencyの バージョン制限を緩和する `add_dependency "rails", "< 8.0"

Slide 12

Slide 12 text

4. RUBYOPT='-W' を設定 して、テストを走らせる 警告が出るようになります

Slide 13

Slide 13 text

Ruby 3.4対応例 Rubyの変更とRails関連のgemへのpull requestのリンクを紹介します あなたが使っているgemにも応用できるかもしれません

Slide 14

Slide 14 text

5. Chilled strings対応 Feature #20205: Enable `frozen_string_literal` by default - Ruby master

Slide 15

Slide 15 text

Chilled strings ● Rubyの変更 ○ https://github.com/ruby/ruby/pull/10262 ○ https://github.com/ruby/ruby/pull/11893 ● 対応例 ○ 警告が出る文字列を dup する ○ https://github.com/rails/rails/pull/51357 ○ https://github.com/nahi/httpclient/pull/462

Slide 16

Slide 16 text

6. エラーメッセージの変更 Feature #16495: Inconsistent quotes in error messages - Ruby master Feature #19117: Include the method owner in backtraces, not just the method name - Ruby master

Slide 17

Slide 17 text

エラーメッセージの変更 ● Rubyの変更 ○ https://github.com/ruby/ruby/pull/9608 ● 対応例 ○ エラーメッセージを確認するテストを変更 ■ backquote ` をsingle quote ' に置き換える ■ エラーメッセージにclass名/module名を含むようにする ● https://github.com/rails/rails/pull/51101

Slide 18

Slide 18 text

7. Hash#inspectの変更 Bug #20433: Hash.inspect for some hash returns syntax invalid representation - Ruby master - Ruby Issue Tracking System

Slide 19

Slide 19 text

Hash#inspectの変更 ● Rubyの変更 ○ https://github.com/ruby/ruby/pull/10924 ● 対応例 ○ テストで期待する結果を式展開 "#{}" で生成する ○ https://github.com/rails/rails/pull/53162 ○ https://github.com/rails/thor/pull/887

Slide 20

Slide 20 text

8.URI::RFC3986_PARSER Bug #19266: URI::Generic should use URI::RFC3986_PARSER instead of URI::DEFAULT_PARSER - Ruby master - Ruby Issue Tracking System

Slide 21

Slide 21 text

URI::RFC3986_PARSER ● Rubyの変更 ○ https://github.com/ruby/ruby/pull/11416 ○ https://github.com/ruby/uri/issues/118 ● 対応例 ○ `defined?(URI::RFC2396_PARSER)`を条件にparserを決める ○ https://github.com/rails/rails/pull/52779 ○ https://github.com/teamcapybara/capybara/pull/2781

Slide 22

Slide 22 text

9. Bundled gemの候補 Feature #20309: Bundled gems for Ruby 3.5 - Ruby master - Ruby Issue Tracking System

Slide 23

Slide 23 text

ostruct ● Rubyの変更 ○ https://github.com/ruby/ruby/pull/10428 ● 対応例 ○ Rakeを13.2以上にあげる ■ https://github.com/rails/sprockets/pull/811 ○ Structに置き換える ■ https://github.com/rack/rack/pull/2004 ○ ostructの利用をやめる ■ https://github.com/rails/jbuilder/pull/567

Slide 24

Slide 24 text

logger ● Rubyの変更 ○ https://github.com/ruby/ruby/commit/d7e558e ● 対応例 ○ gemspecに追加する  ■ https://github.com/rails/rails/pull/52024 ● Note : gemspecにbundled gem 候補を追加する場合は、依存関係の 一番下のgemに行う

Slide 25

Slide 25 text

10. gemにRuby 3.4対応の pull requestを出す

Slide 26

Slide 26 text

11. あせらない gemメンテナーからすぐ反応がなくても気長に待ちましょう

Slide 27

Slide 27 text

12. フィードバックする リリース前にフィードバックするためにpreviewバージョンがあります

Slide 28

Slide 28 text

フィードバックする ● RubyやRailsは”天から与えられる”ソフトウェアではない ● 公式な報告窓口に報告したり ○ https://bugs.ruby-lang.org ○ https://github.com/rails/rails/issues ● ミートアップなどで開発者に質問してみる ● 例 : Ruby 3.3.6でのostruct, loggerなどの警告を抑止 ○ https://bugs.ruby-lang.org/issues/20737 ○ 警告はRuby 3.4から出るべきとの考えから

Slide 29

Slide 29 text

おしまい