From cf8e21993d6e136c273ae45acd71cc0cc7b28efa Mon Sep 17 00:00:00 2001 From: kg8m Date: Sat, 28 Dec 2024 19:53:01 +0900 Subject: [PATCH 1/4] Support Ruby 3.4 --- .github/workflows/checks.yml | 7 ++++--- .github/workflows/dependabot-autolabeling.yml | 2 +- .github/workflows/update-rbs-collection.yml | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 19e464d..fc5df64 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -16,6 +16,7 @@ jobs: ruby-version: - "3.2" - "3.3" + - "3.4" rails-version: - "~> 7.0.0" - "~> 7.1.0" @@ -68,7 +69,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: "3.3" + ruby-version: "3.4" bundler-cache: true - name: RuboCop @@ -86,7 +87,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: "3.3" + ruby-version: "3.4" bundler-cache: true - name: Prepare for typecheck @@ -108,7 +109,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: "3.3" + ruby-version: "3.4" bundler-cache: true - name: Check YARD docs diff --git a/.github/workflows/dependabot-autolabeling.yml b/.github/workflows/dependabot-autolabeling.yml index 7305ad8..146d478 100644 --- a/.github/workflows/dependabot-autolabeling.yml +++ b/.github/workflows/dependabot-autolabeling.yml @@ -18,7 +18,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: "3.3" + ruby-version: "3.4" bundler-cache: true - name: Generate token diff --git a/.github/workflows/update-rbs-collection.yml b/.github/workflows/update-rbs-collection.yml index 4637e2d..31e63b4 100644 --- a/.github/workflows/update-rbs-collection.yml +++ b/.github/workflows/update-rbs-collection.yml @@ -19,7 +19,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: "3.3" + ruby-version: "3.4" bundler-cache: true - name: Generate token From e4eade7f71c7825f49b989e23aa4df37d2dc078f Mon Sep 17 00:00:00 2001 From: kg8m Date: Sat, 28 Dec 2024 19:54:48 +0900 Subject: [PATCH 2/4] The error message format has been updated in Ruby 3.4 Single quotes (') are now used instead of backticks (\`). --- spec/models/tanshuku/url_spec.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/models/tanshuku/url_spec.rb b/spec/models/tanshuku/url_spec.rb index 7db7bc7..02b90e1 100644 --- a/spec/models/tanshuku/url_spec.rb +++ b/spec/models/tanshuku/url_spec.rb @@ -1142,7 +1142,9 @@ context "and url_options isn’t given" do it "raises NoMethodError due to `nil.merge`" do - expect { tanshuku_url.shortened_url }.to raise_error(NoMethodError, /\bundefined method `merge' for nil\b/) + # Error message with Ruby 3.3 or older: undefined method `merge' for nil + # Error message with Ruby 3.4 or newer: undefined method 'merge' for nil + expect { tanshuku_url.shortened_url }.to raise_error(NoMethodError, /\bundefined method [`']merge' for nil\b/) end end @@ -1150,9 +1152,11 @@ let(:url_options) { { host: "example.com", protocol: :https } } it "raises NoMethodError due to `nil.merge`" do + # Error message with Ruby 3.3 or older: undefined method `merge' for nil + # Error message with Ruby 3.4 or newer: undefined method 'merge' for nil expect { tanshuku_url.shortened_url(url_options) }.to raise_error( NoMethodError, - /\bundefined method `merge' for nil\b/ + /\bundefined method [`']merge' for nil\b/ ) end end From daa7fecdabe980c8e111c007b06469fc90565abe Mon Sep 17 00:00:00 2001 From: kg8m Date: Sat, 28 Dec 2024 19:59:45 +0900 Subject: [PATCH 3/4] `ffi-1.17.0-*` is incompatible with Ruby 3.4 --- Gemfile.lock | 3 --- 1 file changed, 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 821ba16..d0f72a8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -96,9 +96,6 @@ GEM drb (2.2.1) erubi (1.13.1) ffi (1.17.0) - ffi (1.17.0-arm64-darwin) - ffi (1.17.0-x86_64-darwin) - ffi (1.17.0-x86_64-linux-gnu) fileutils (1.7.3) globalid (1.2.1) activesupport (>= 6.1) From 527e75902c83a15713758ee9c1f43a15e6ad107c Mon Sep 17 00:00:00 2001 From: kg8m Date: Sat, 28 Dec 2024 20:21:58 +0900 Subject: [PATCH 4/4] Some gems have been removed from the default gems in Ruby 3.4 --- Gemfile | 11 +++++++++++ Gemfile.lock | 8 +++++++- rbs_collection.lock.yaml | 20 ++++++-------------- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/Gemfile b/Gemfile index 8ff16ca..70d87e7 100644 --- a/Gemfile +++ b/Gemfile @@ -16,6 +16,17 @@ else gem "rails", ENV.fetch("RAILS_VERSION") end +# For Ruby 3.4+ +# +# warning: ... was loaded from the standard library, but is not part of the default gems starting from Ruby 3.4.0. +# +# 'Kernel.require': cannot load such file -- ... (LoadError) +gem "base64" +gem "benchmark" +gem "bigdecimal" +gem "drb" +gem "mutex_m" + group :development, :test do gem "sprockets-rails" diff --git a/Gemfile.lock b/Gemfile.lock index d0f72a8..53720b0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -123,6 +123,7 @@ GEM mini_mime (1.1.5) mini_portile2 (2.8.8) minitest (5.25.4) + mutex_m (0.3.0) net-imap (0.5.4) date net-protocol @@ -312,7 +313,12 @@ PLATFORMS DEPENDENCIES addressable + base64 + benchmark + bigdecimal bump + drb + mutex_m paint puma rails @@ -334,4 +340,4 @@ DEPENDENCIES yard BUNDLED WITH - 2.4.10 + 2.6.2 diff --git a/rbs_collection.lock.yaml b/rbs_collection.lock.yaml index 4d5d5fb..e00966f 100644 --- a/rbs_collection.lock.yaml +++ b/rbs_collection.lock.yaml @@ -125,10 +125,6 @@ gems: version: '0' source: type: stdlib -- name: dbm - version: '0' - source: - type: stdlib - name: delegate version: '0' source: @@ -210,9 +206,9 @@ gems: source: type: stdlib - name: mutex_m - version: '0' + version: 0.3.0 source: - type: stdlib + type: rubygems - name: net-protocol version: '0' source: @@ -237,14 +233,6 @@ gems: version: '0' source: type: stdlib -- name: pstore - version: '0' - source: - type: stdlib -- name: psych - version: '0' - source: - type: stdlib - name: rack version: '2.2' source: @@ -309,6 +297,10 @@ gems: revision: ccbd2bbc6be5c195df1d90aa68d64916a9e7d0ab remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems +- name: stringio + version: '0' + source: + type: stdlib - name: tempfile version: '0' source: