From 3305d7165542b5860984ef6680958a9556ebc88b Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Sat, 3 Jan 2026 11:41:51 +0800 Subject: [PATCH 01/14] Update to support Ruby 4.0 --- .github/workflows/release-crate-gem.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-crate-gem.yml b/.github/workflows/release-crate-gem.yml index f25d6ac5..9e7d71e4 100644 --- a/.github/workflows/release-crate-gem.yml +++ b/.github/workflows/release-crate-gem.yml @@ -32,7 +32,7 @@ jobs: - uses: actions/checkout@v4 - uses: oxidize-rb/actions/setup-ruby-and-rust@v1.3.0 with: - ruby-version: "3.4" + ruby-version: "4.0" bundler-cache: true cargo-cache: true cargo-vendor: false @@ -45,7 +45,7 @@ jobs: with: platform: ${{ matrix.ruby-platform }} working-directory: autocorrect-rb/ - ruby-versions: "3.4, 3.3, 3.2" # optional + ruby-versions: "4.0, 3.4, 3.3" # optional - name: Upload Gem uses: actions/upload-artifact@v4 @@ -62,7 +62,7 @@ jobs: - uses: actions/checkout@v4 - uses: oxidize-rb/actions/setup-ruby-and-rust@v1.3.0 with: - ruby-version: "3.4" + ruby-version: "4.0" bundler-cache: false cargo-cache: true cargo-vendor: true @@ -89,7 +89,7 @@ jobs: steps: - uses: ruby/setup-ruby@v1 with: - ruby-version: "3.4" + ruby-version: "4.0" bundler-cache: true - uses: actions/download-artifact@v4 with: From 50b470119cfabc6ad99ba7b9c801f6efcf58969d Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Sat, 3 Jan 2026 11:43:05 +0800 Subject: [PATCH 02/14] . --- .github/workflows/release-crate-gem.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release-crate-gem.yml b/.github/workflows/release-crate-gem.yml index 9e7d71e4..8bce4d25 100644 --- a/.github/workflows/release-crate-gem.yml +++ b/.github/workflows/release-crate-gem.yml @@ -7,12 +7,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/cargo@v1 - if: startsWith(github.ref, 'refs/tags/v') - name: Release Crate - with: - command: publish - args: --manifest-path autocorrect/Cargo.toml --token ${{ secrets.CARGO_REGISTRY_TOKEN }} + # - uses: actions-rs/cargo@v1 + # if: startsWith(github.ref, 'refs/tags/v') + # name: Release Crate + # with: + # command: publish + # args: --manifest-path autocorrect/Cargo.toml --token ${{ secrets.CARGO_REGISTRY_TOKEN }} build: needs: From fa14dce53d9e4c0048cb0e512da020ecca3ffed8 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Sat, 3 Jan 2026 11:44:37 +0800 Subject: [PATCH 03/14] . --- .github/workflows/release-crate.yml | 15 +++++++++++++++ .../{release-crate-gem.yml => release-gem.yml} | 16 ---------------- 2 files changed, 15 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/release-crate.yml rename .github/workflows/{release-crate-gem.yml => release-gem.yml} (86%) diff --git a/.github/workflows/release-crate.yml b/.github/workflows/release-crate.yml new file mode 100644 index 00000000..ba5c2221 --- /dev/null +++ b/.github/workflows/release-crate.yml @@ -0,0 +1,15 @@ +name: "Release Crate" +on: + workflow_dispatch: +jobs: + publish_crate: + name: Publish Crate + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rs/cargo@v1 + if: startsWith(github.ref, 'refs/tags/v') + name: Release Crate + with: + command: publish + args: --manifest-path autocorrect/Cargo.toml --token ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/.github/workflows/release-crate-gem.yml b/.github/workflows/release-gem.yml similarity index 86% rename from .github/workflows/release-crate-gem.yml rename to .github/workflows/release-gem.yml index 8bce4d25..5b975831 100644 --- a/.github/workflows/release-crate-gem.yml +++ b/.github/workflows/release-gem.yml @@ -2,21 +2,7 @@ name: "Release Crate & RubyGem" on: workflow_dispatch: jobs: - publish_crate: - name: Publish Crate - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - # - uses: actions-rs/cargo@v1 - # if: startsWith(github.ref, 'refs/tags/v') - # name: Release Crate - # with: - # command: publish - # args: --manifest-path autocorrect/Cargo.toml --token ${{ secrets.CARGO_REGISTRY_TOKEN }} - build: - needs: - - publish_crate name: Build compile gems runs-on: ubuntu-latest strategy: @@ -55,8 +41,6 @@ jobs: build_source: name: Build source gem - needs: - - publish_crate runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 788b633541f8aa48897977ed72d69721d53e8c50 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Sat, 3 Jan 2026 11:45:03 +0800 Subject: [PATCH 04/14] . --- .github/workflows/{release-gem.yml => release-rubygem.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{release-gem.yml => release-rubygem.yml} (98%) diff --git a/.github/workflows/release-gem.yml b/.github/workflows/release-rubygem.yml similarity index 98% rename from .github/workflows/release-gem.yml rename to .github/workflows/release-rubygem.yml index 5b975831..2dd1112a 100644 --- a/.github/workflows/release-gem.yml +++ b/.github/workflows/release-rubygem.yml @@ -1,4 +1,4 @@ -name: "Release Crate & RubyGem" +name: "Release RubyGem" on: workflow_dispatch: jobs: From 3ed02e105521a3fbc02508cef7dc491ec61779f7 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Sat, 3 Jan 2026 11:47:21 +0800 Subject: [PATCH 05/14] . --- .github/workflows/release-rubygem.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release-rubygem.yml b/.github/workflows/release-rubygem.yml index 2dd1112a..58425c19 100644 --- a/.github/workflows/release-rubygem.yml +++ b/.github/workflows/release-rubygem.yml @@ -16,9 +16,9 @@ jobs: - x86_64-linux-musl steps: - uses: actions/checkout@v4 - - uses: oxidize-rb/actions/setup-ruby-and-rust@v1.3.0 + - uses: oxidize-rb/actions/setup-ruby-and-rust@v1.4.4 with: - ruby-version: "4.0" + ruby-version: "3.4" bundler-cache: true cargo-cache: true cargo-vendor: false @@ -27,7 +27,7 @@ jobs: run: | touch Rakefile - - uses: oxidize-rb/actions/cross-gem@v1.3.0 + - uses: oxidize-rb/actions/cross-gem@v1.4.4 with: platform: ${{ matrix.ruby-platform }} working-directory: autocorrect-rb/ @@ -44,9 +44,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: oxidize-rb/actions/setup-ruby-and-rust@v1.3.0 + - uses: oxidize-rb/actions/setup-ruby-and-rust@v1.4.4 with: - ruby-version: "4.0" + ruby-version: "3.4" bundler-cache: false cargo-cache: true cargo-vendor: true @@ -73,7 +73,7 @@ jobs: steps: - uses: ruby/setup-ruby@v1 with: - ruby-version: "4.0" + ruby-version: "3.4" bundler-cache: true - uses: actions/download-artifact@v4 with: From 91f3717ec7b99d43862be07eca7bab48a839fa81 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Sat, 3 Jan 2026 11:48:51 +0800 Subject: [PATCH 06/14] . --- .github/workflows/release-rubygem.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release-rubygem.yml b/.github/workflows/release-rubygem.yml index 58425c19..1a0fe90e 100644 --- a/.github/workflows/release-rubygem.yml +++ b/.github/workflows/release-rubygem.yml @@ -1,6 +1,9 @@ name: "Release RubyGem" on: workflow_dispatch: + push: + branches: + - support-ruby-4.0 jobs: build: name: Build compile gems From 0f5528b2bb181141efebac1dbb414567902bf1bb Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 5 Feb 2026 10:44:53 +0800 Subject: [PATCH 07/14] . --- .github/workflows/release-rubygem.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-rubygem.yml b/.github/workflows/release-rubygem.yml index 1a0fe90e..d0a3b65f 100644 --- a/.github/workflows/release-rubygem.yml +++ b/.github/workflows/release-rubygem.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@v4 - uses: oxidize-rb/actions/setup-ruby-and-rust@v1.4.4 with: - ruby-version: "3.4" + ruby-version: "4.0" bundler-cache: true cargo-cache: true cargo-vendor: false @@ -34,7 +34,7 @@ jobs: with: platform: ${{ matrix.ruby-platform }} working-directory: autocorrect-rb/ - ruby-versions: "4.0, 3.4, 3.3" # optional + ruby-versions: "4.0, 3.4, 3.3" - name: Upload Gem uses: actions/upload-artifact@v4 @@ -49,7 +49,7 @@ jobs: - uses: actions/checkout@v4 - uses: oxidize-rb/actions/setup-ruby-and-rust@v1.4.4 with: - ruby-version: "3.4" + ruby-version: "4.0" bundler-cache: false cargo-cache: true cargo-vendor: true @@ -76,7 +76,7 @@ jobs: steps: - uses: ruby/setup-ruby@v1 with: - ruby-version: "3.4" + ruby-version: "4.0" bundler-cache: true - uses: actions/download-artifact@v4 with: From 547890e5309716e9f391e709f97ae88a342905bb Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 5 Feb 2026 10:47:47 +0800 Subject: [PATCH 08/14] Update rb-sys --- Cargo.lock | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f90f8602..4633a986 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -493,7 +493,7 @@ dependencies = [ "bitflags 2.9.1", "cexpr", "clang-sys", - "itertools 0.12.1", + "itertools 0.10.5", "lazy_static", "lazycell", "proc-macro2", @@ -1937,15 +1937,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.14.0" @@ -2046,7 +2037,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" dependencies = [ "cfg-if", - "windows-targets 0.53.2", + "windows-targets 0.48.5", ] [[package]] @@ -2883,18 +2874,18 @@ dependencies = [ [[package]] name = "rb-sys" -version = "0.9.116" +version = "0.9.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7059846f68396df83155779c75336ca24567741cb95256e6308c9fcc370e8dad" +checksum = "c85c4188462601e2aa1469def389c17228566f82ea72f137ed096f21591bc489" dependencies = [ "rb-sys-build", ] [[package]] name = "rb-sys-build" -version = "0.9.116" +version = "0.9.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac217510df41b9ffc041573e68d7a02aaff770c49943c7494441c4b224b0ecd0" +checksum = "568068db4102230882e6d4ae8de6632e224ca75fe5970f6e026a04e91ed635d3" dependencies = [ "bindgen", "lazy_static", From a634e76e359ff2c7d52183a06709d339593212d0 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 5 Feb 2026 11:05:56 +0800 Subject: [PATCH 09/14] Update magnus --- Cargo.lock | 14 ++++++-------- Makefile | 2 +- autocorrect-rb/Gemfile.lock | 7 +++++-- autocorrect-rb/ext/autocorrect/Cargo.toml | 3 ++- autocorrect-rb/ext/autocorrect/src/lib.rs | 8 ++++---- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4633a986..d8faea9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2112,9 +2112,8 @@ dependencies = [ [[package]] name = "magnus" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d87ae53030f3a22e83879e666cb94e58a7bdf31706878a0ba48752994146dab" +version = "0.9.0" +source = "git+https://github.com/matsadler/magnus.git?rev=c7e33c181c44860a33e7d8cd8f39090145f061d0#c7e33c181c44860a33e7d8cd8f39090145f061d0" dependencies = [ "magnus-macros", "rb-sys", @@ -2124,9 +2123,8 @@ dependencies = [ [[package]] name = "magnus-macros" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5968c820e2960565f647819f5928a42d6e874551cab9d88d75e3e0660d7f71e3" +version = "0.9.0" +source = "git+https://github.com/matsadler/magnus.git?rev=c7e33c181c44860a33e7d8cd8f39090145f061d0#c7e33c181c44860a33e7d8cd8f39090145f061d0" dependencies = [ "proc-macro2", "quote", @@ -2898,9 +2896,9 @@ dependencies = [ [[package]] name = "rb-sys-env" -version = "0.1.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb" +checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a" [[package]] name = "redox_syscall" diff --git a/Makefile b/Makefile index 71546f87..75954dc9 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ test\:node\:cli: test\:python: cd autocorrect-py && python3 -m pip install . && python3 -m pytest test\:ruby: - cd autocorrect-rb && bundle && rake compile && rake test + cd autocorrect-rb && bundle && bundle exec rake compile && bundle exec rake test test\:java: cd autocorrect-java && make test install: diff --git a/autocorrect-rb/Gemfile.lock b/autocorrect-rb/Gemfile.lock index df1bab23..1a73d29d 100644 --- a/autocorrect-rb/Gemfile.lock +++ b/autocorrect-rb/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - autocorrect-rb (2.13.0) + autocorrect-rb (2.16.3) rb_sys (>= 0.9.105) GEM @@ -31,7 +31,9 @@ GEM concurrent-ruby (~> 1.0) logger (1.6.4) memory_profiler (1.1.0) - minitest (5.25.4) + minitest (6.0.1) + prism (~> 1.5) + prism (1.9.0) rake (13.2.1) rake-compiler (1.2.8) rake @@ -47,6 +49,7 @@ PLATFORMS arm64-darwin-22 arm64-darwin-23 arm64-darwin-24 + arm64-darwin-25 x86_64-linux DEPENDENCIES diff --git a/autocorrect-rb/ext/autocorrect/Cargo.toml b/autocorrect-rb/ext/autocorrect/Cargo.toml index 9657ceee..0f7795a5 100644 --- a/autocorrect-rb/ext/autocorrect/Cargo.toml +++ b/autocorrect-rb/ext/autocorrect/Cargo.toml @@ -10,4 +10,5 @@ name = "autocorrect" [dependencies] autocorrect = "2" -magnus = "0.7" +# Wait 0.9.0 +magnus = { git = "https://github.com/matsadler/magnus.git", rev = "c7e33c181c44860a33e7d8cd8f39090145f061d0" } diff --git a/autocorrect-rb/ext/autocorrect/src/lib.rs b/autocorrect-rb/ext/autocorrect/src/lib.rs index fc78a839..008aa89d 100644 --- a/autocorrect-rb/ext/autocorrect/src/lib.rs +++ b/autocorrect-rb/ext/autocorrect/src/lib.rs @@ -1,4 +1,4 @@ -use magnus::{define_class, function, method, Error, IntoValue, Module, Object}; +use magnus::{Error, IntoValue, Module, Object, Ruby, function, method}; #[derive(Debug, Clone)] pub struct LineResult { @@ -137,14 +137,14 @@ pub fn load_config(config_str: String) { } #[magnus::init(name = "autocorrect")] -fn init() -> Result<(), Error> { - let class = define_class("AutoCorrect", magnus::class::object())?; +fn init(ruby: &Ruby) -> Result<(), Error> { + let class = ruby.define_class("AutoCorrect", ruby.class_object())?; class.define_singleton_method("format", function!(format, 1))?; class.define_singleton_method("format_for", function!(format_for, 2))?; class.define_singleton_method("lint_for", function!(lint_for, 2))?; class.define_singleton_method("load_config", function!(load_config, 1))?; - let ignorer_class = class.define_class("Ignorer", magnus::class::object())?; + let ignorer_class = ruby.define_class("Ignorer", ruby.class_object())?; ignorer_class.define_singleton_method("new", function!(Ignorer::new, 1))?; ignorer_class.define_method("ignored?", method!(Ignorer::is_ignored, 1))?; From 71dd2ff46350b6589d07d6e5e1806b595ecfe37a Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 5 Feb 2026 11:11:41 +0800 Subject: [PATCH 10/14] Update --- .github/workflows/release-rubygem.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release-rubygem.yml b/.github/workflows/release-rubygem.yml index d0a3b65f..36961ace 100644 --- a/.github/workflows/release-rubygem.yml +++ b/.github/workflows/release-rubygem.yml @@ -84,7 +84,6 @@ jobs: - name: Display structure of built gems run: | - mv -f **/autocorrect-*.gem ./ ls -lha autocorrect-*.gem working-directory: pkg/ From fd610d4a94f61763c963b9d7add058c39abade2e Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 5 Feb 2026 11:14:59 +0800 Subject: [PATCH 11/14] . --- .github/workflows/ci.yml | 2 +- .github/workflows/release-rubygem.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8de42a6..bd2bd068 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: - name: Test run: | rustup component add clippy - cargo install cargo-machete + cargo install cargo-machete -f cargo machete cargo clippy cargo test diff --git a/.github/workflows/release-rubygem.yml b/.github/workflows/release-rubygem.yml index 36961ace..b2b5cd32 100644 --- a/.github/workflows/release-rubygem.yml +++ b/.github/workflows/release-rubygem.yml @@ -84,7 +84,7 @@ jobs: - name: Display structure of built gems run: | - ls -lha autocorrect-*.gem + ls -lha working-directory: pkg/ - name: Publish to RubyGem From 2a73ef766b14e9bb03139b83259a1933bf1749d5 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 5 Feb 2026 11:18:45 +0800 Subject: [PATCH 12/14] . --- .github/workflows/release-rubygem.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-rubygem.yml b/.github/workflows/release-rubygem.yml index b2b5cd32..3b728be0 100644 --- a/.github/workflows/release-rubygem.yml +++ b/.github/workflows/release-rubygem.yml @@ -84,7 +84,9 @@ jobs: - name: Display structure of built gems run: | - ls -lha + mkdir -p dist/ + cp -f cross-gem-*/*.gem dist/ + tree working-directory: pkg/ - name: Publish to RubyGem @@ -96,7 +98,7 @@ jobs: touch $HOME/.gem/credentials chmod 0600 $HOME/.gem/credentials printf -- "---\n:rubygems_api_key: ${RUBYGEM_TOKEN}\n" > $HOME/.gem/credentials - for filename in autocorrect-*.gem; do + for filename in dist/autocorrect-*.gem; do echo $filename gem push $filename done From 2690572049cef98284dcefc32650010ef99ac005 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 5 Feb 2026 11:25:42 +0800 Subject: [PATCH 13/14] Fix ruby define class./ --- autocorrect-rb/ext/autocorrect/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autocorrect-rb/ext/autocorrect/src/lib.rs b/autocorrect-rb/ext/autocorrect/src/lib.rs index 008aa89d..4c1d41c7 100644 --- a/autocorrect-rb/ext/autocorrect/src/lib.rs +++ b/autocorrect-rb/ext/autocorrect/src/lib.rs @@ -144,7 +144,7 @@ fn init(ruby: &Ruby) -> Result<(), Error> { class.define_singleton_method("lint_for", function!(lint_for, 2))?; class.define_singleton_method("load_config", function!(load_config, 1))?; - let ignorer_class = ruby.define_class("Ignorer", ruby.class_object())?; + let ignorer_class = class.define_class("Ignorer", ruby.class_object())?; ignorer_class.define_singleton_method("new", function!(Ignorer::new, 1))?; ignorer_class.define_method("ignored?", method!(Ignorer::is_ignored, 1))?; From 5929d38666af83f172adb2a73d11a2339fc9183b Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 5 Feb 2026 11:29:17 +0800 Subject: [PATCH 14/14] Fix ci --- .github/workflows/release-rubygem.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-rubygem.yml b/.github/workflows/release-rubygem.yml index 3b728be0..98c5fee0 100644 --- a/.github/workflows/release-rubygem.yml +++ b/.github/workflows/release-rubygem.yml @@ -85,7 +85,7 @@ jobs: - name: Display structure of built gems run: | mkdir -p dist/ - cp -f cross-gem-*/*.gem dist/ + cp -n cross-gem-*/*.gem dist/ tree working-directory: pkg/