Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/release-crate.yml
Original file line number Diff line number Diff line change
@@ -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 }}
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
name: "Release Crate & RubyGem"
name: "Release RubyGem"
on:
workflow_dispatch:
push:
branches:
- support-ruby-4.0
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:
Expand All @@ -30,9 +19,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: "3.4"
ruby-version: "4.0"
bundler-cache: true
cargo-cache: true
cargo-vendor: false
Expand All @@ -41,11 +30,11 @@ 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/
ruby-versions: "3.4, 3.3, 3.2" # optional
ruby-versions: "4.0, 3.4, 3.3"

- name: Upload Gem
uses: actions/upload-artifact@v4
Expand All @@ -55,14 +44,12 @@ jobs:

build_source:
name: Build source gem
needs:
- publish_crate
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: "3.4"
ruby-version: "4.0"
bundler-cache: false
cargo-cache: true
cargo-vendor: true
Expand All @@ -89,16 +76,17 @@ 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:
path: pkg/

- name: Display structure of built gems
run: |
mv -f **/autocorrect-*.gem ./
ls -lha autocorrect-*.gem
mkdir -p dist/
cp -n cross-gem-*/*.gem dist/
tree
working-directory: pkg/

- name: Publish to RubyGem
Expand All @@ -110,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
Expand Down
35 changes: 12 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 5 additions & 2 deletions autocorrect-rb/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
autocorrect-rb (2.13.0)
autocorrect-rb (2.16.3)
rb_sys (>= 0.9.105)

GEM
Expand Down Expand Up @@ -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
Expand All @@ -47,6 +49,7 @@ PLATFORMS
arm64-darwin-22
arm64-darwin-23
arm64-darwin-24
arm64-darwin-25
x86_64-linux

DEPENDENCIES
Expand Down
3 changes: 2 additions & 1 deletion autocorrect-rb/ext/autocorrect/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
8 changes: 4 additions & 4 deletions autocorrect-rb/ext/autocorrect/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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 = 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))?;

Expand Down
Loading