Skip to content

feat: Ruby 바인딩 추가 - #171

Open
kdyann wants to merge 8 commits into
dev-five-git:mainfrom
kdyann:feat/ruby-binding
Open

feat: Ruby 바인딩 추가#171
kdyann wants to merge 8 commits into
dev-five-git:mainfrom
kdyann:feat/ruby-binding

Conversation

@kdyann

@kdyann kdyann commented Jul 2, 2026

Copy link
Copy Markdown

개요

한국어 점역 엔진의 Ruby 바인딩(packages/ruby)을 추가합니다. Python(pyo3) 바인딩과 대칭되는 magnus + rb-sys 네이티브 확장 방식이며, RubyGems에 braillify gem으로 배포됩니다.

주요 변경 사항

  • packages/ruby/ — magnus 0.8 바인딩 crate(braillify_rb) + gem 패키징
    • 소스 gem은 crates.io의 braillify를 사용하고, 저장소 내 빌드는 루트 [patch.crates-io]로 로컬 libs/braillify를 사용했습니다. (프리컴파일 gem은 항상 repo 코어로 빌드됨)
    • 버전 단일 소스는 packages/ruby/Cargo.toml — gemspec이 여기서 버전을 파싱합니다.
  • CI (publish.yml)
    • ruby-test: 3개 OS에서 rake compile + minitest
    • ruby-build: oxidize-rb/actions/cross-gem@v1로 5개 플랫폼(linux x86_64/arm64,
      macOS x86_64/arm64, Windows ucrt) 프리컴파일 gem + 소스 gem 빌드
    • ruby-publish: rubygems.org 배포 (버전/플랫폼별 idempotent 체크)
    • 기존 test 잡에 Ruby 셋업을 추가했습니다. (tarpaulin/clippy가 ruby crate를 포함)
  • changepacks: packages/ruby/Cargo.toml 등록했습니다.

테스트

  • Rust 단위 테스트 7건 (cargo test -p braillify_rb, rb-sys-test-helpers 임베디드 VM)
  • minitest 6건 29 assertions (happy path, 에러 매핑, 인코딩, byte↔unicode 일치)
  • 로컬 검증을 완료했습니다: Linux(Docker, Ruby 3.1) + Windows(ucrt Ruby 3.4 + GNU Rust) 양쪽에서 cargo test / rake compile / minitest / smoke / gem build 전부 통과. macOS는 CI에서 확인합니다.

머지 전 필요 사항

  • repo secret RUBYGEMS_API_KEY 등록이 필요합니다. (rubygems.org API key, gem 이름은 braillify로)

kdyann and others added 3 commits July 2, 2026 14:15
- packages/ruby: magnus 기반 네이티브 확장 (encode / translate_to_unicode / translate_to_braille_font)
- 소스 gem은 crates.io braillify 사용, 저장소 빌드는 [patch.crates-io]로 로컬 코어 사용
- rb-sys-test-helpers 임베디드 VM 단위 테스트 + minitest 통합 테스트
- CI: ruby-test(3 OS) / ruby-build(cross-gem 5플랫폼) / ruby-publish(rubygems.org) 잡 추가
- changepacks에 packages/ruby/Cargo.toml 등록 (버전 단일 소스)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Windows 로컬 검증(ucrt Ruby 3.4 + GNU Rust)에서 cargo test/rake compile/minitest 전부 통과 확인
- mswin(개발 빌드) Ruby 대신 rb-sys 공식 setup-ruby-and-rust 액션으로 툴체인 매칭 위임
- Windows bindgen(libclang) 환경변수 요구사항 README에 문서화

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
packages/ruby/src/lib.rs 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@owjs3901

owjs3901 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

conflicts 만 resolve 하면 될 것 같습니다

@owjs3901
owjs3901 self-requested a review August 8, 2026 04:25

module Braillify
# 버전 단일 소스는 Cargo.toml — changepacks가 bump하는 파일이다.
VERSION = File.read(File.expand_path("../../Cargo.toml", __dir__), encoding: "UTF-8")[/^version = "([^"]+)"/, 1].freeze

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good

Comment thread Cargo.toml
# packages/ruby는 소스 gem 배포를 위해 braillify를 crates.io 버전으로 의존한다.
# 저장소 내 빌드(개발/CI/프리컴파일 gem)는 이 patch로 로컬 코어를 사용한다.
[patch.crates-io]
braillify = { path = "libs/braillify" }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 내용은 로컬의 braillify를 참조하겠다는 것이 아닌지 여쭙습니다

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네 맞습니다, 말씀하신 대로 해당 설정은 저장소 내부에서 개발하거나 CI 및 프리컴파일 gem을 빌드할 때 로컬 libs/braillify를 참조하기 위한 것입니다.
packages/ruby/Cargo.toml에는 braillify = { version = "2" }로 crates.io 의존성을 선언해 두었고, 저장소 내부에서 빌드할 때만 루트 Cargo.toml의 [patch.crates-io]가 적용되어 이를 로컬 libs/braillify로 대체하도록 구성했습니다. 반면 배포되는 소스 gem에는 루트 Cargo.toml과 libs/braillify가 포함되지 않기 때문에, 사용자가 소스 gem을 설치할 때는 patch가 적용되지 않고 crates.io에 배포된 braillify 2.x를 사용하게 됩니다.

Ruby 패키지에 직접 path = "../../libs/braillify"를 지정하면 소스 gem을 단독으로 설치할 때 해당 경로가 존재하지 않아 빌드가 실패할 수 있어 이 방식을 선택했습니다.

혹시 이러한 목적에 더 적합하거나 일반적으로 권장되는 구성이 있다면 의견 부탁드립니다!

@kdyann
kdyann requested a review from owjs3901 August 13, 2026 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants