diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..21debbe --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + test: + name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby: ["3.2", "3.3", "3.4", "4.0"] + rails: ["7.1", "7.2", "8.0", "8.1"] + env: + BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.rails }}.gemfile + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run tests + run: bundle exec rake test diff --git a/.gitignore b/.gitignore index dbc5f0f..04cf888 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ *.gem Gemfile.lock .ruby-lsp/ +/gemfiles/*.lock +/test/tmp/ diff --git a/.ruby-version b/.ruby-version index 4d54dad..7919852 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -4.0.2 +4.0.9 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b4c58b..1ec95b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- **Ruby × Rails compatibility matrix** in the README and a GitHub Actions CI + workflow that runs the test suite on Ruby 3.2, 3.3, 3.4 and 4.0 against + Rails 7.1, 7.2, 8.0 and 8.1 (per-version Gemfiles under `gemfiles/`). + +### Changed + +- **Minimum Ruby raised to 3.2.** Phlex 2.x (required by `phlex-rails >= 2.0`) + already needs Ruby 3.2+, so the previous `>= 3.1` couldn't be installed on 3.1. + ## [0.1.0] - 2026-06-09 ### Added diff --git a/CLAUDE.md b/CLAUDE.md index e3f17eb..238ca6e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## What this is -`ruby_ui_scaffold` is a Ruby gem (Rails plugin) that provides `rails g ruby_ui_scaffold` — a drop-in replacement for `rails g scaffold` that emits **Phlex view classes wired to [ruby_ui](https://github.com/ruby-ui/ruby_ui) components** instead of ERB. It also ships a `rails ruby_ui_scaffold:seed` command that populates models with realistic fake data via Faker. Ruby >= 3.1, Rails >= 7.1. +`ruby_ui_scaffold` is a Ruby gem (Rails plugin) that provides `rails g ruby_ui_scaffold` — a drop-in replacement for `rails g scaffold` that emits **Phlex view classes wired to [ruby_ui](https://github.com/ruby-ui/ruby_ui) components** instead of ERB. It also ships a `rails ruby_ui_scaffold:seed` command that populates models with realistic fake data via Faker. Ruby >= 3.2, Rails >= 7.1. This repo is the gem source, not a host Rails app. There is no `bin/rails` here; the generator/command behavior is exercised through Rails' generator test harness against a temp destination. diff --git a/README.md b/README.md index 54fa0e8..ac77835 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,30 @@ Drop-in alternative to `rails g scaffold` — generates model, migration, contro ## Requirements +- Ruby 3.2+ - Rails 7.1+ - Tailwind CSS (any Rails Tailwind setup — `tailwindcss-rails` is fine) +### Compatibility matrix + +The full test suite runs in CI against every combination below. + +| Ruby \ Rails | 7.1 | 7.2 | 8.0 | 8.1 | +|--------------|:---:|:---:|:---:|:---:| +| **4.0** | ✅ | ✅ | ✅ | ✅ | +| **3.4** | ✅ | ✅ | ✅ | ✅ | +| **3.3** | ✅ | ✅ | ✅ | ✅ | +| **3.2** | ✅ | ✅ | ✅ | ✅ | + +Last verified with Ruby 4.0.9 and Rails 8.1.4.1. Ruby 3.1 isn't supported because Phlex 2.x (required by `phlex-rails >= 2.0`) needs Ruby 3.2+. + +To run the suite against a specific Rails version locally: + +```bash +BUNDLE_GEMFILE=gemfiles/rails_8.1.gemfile bundle install +BUNDLE_GEMFILE=gemfiles/rails_8.1.gemfile bundle exec rake test +``` + ## Disclaimer `ruby_ui_scaffold` is a development-only generator built on the [`ruby_ui`](https://github.com/ruby-ui/ruby_ui) component library — you add both to your app. [`faker`](https://github.com/faker-ruby/faker) and [`lucide-rails`](https://github.com/heyvito/lucide-rails) come along automatically as runtime dependencies of `ruby_ui_scaffold` — `faker` powers the `seed` command, and `lucide-rails` renders the icons in the generated views (the index action menu plus the New / Edit / Create / Update buttons). diff --git a/gemfiles/rails_7.1.gemfile b/gemfiles/rails_7.1.gemfile new file mode 100644 index 0000000..f508723 --- /dev/null +++ b/gemfiles/rails_7.1.gemfile @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gem "rails", "~> 7.1.0" + +gemspec path: "../" diff --git a/gemfiles/rails_7.2.gemfile b/gemfiles/rails_7.2.gemfile new file mode 100644 index 0000000..50cc830 --- /dev/null +++ b/gemfiles/rails_7.2.gemfile @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gem "rails", "~> 7.2.0" + +gemspec path: "../" diff --git a/gemfiles/rails_8.0.gemfile b/gemfiles/rails_8.0.gemfile new file mode 100644 index 0000000..22de0d7 --- /dev/null +++ b/gemfiles/rails_8.0.gemfile @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gem "rails", "~> 8.0.0" + +gemspec path: "../" diff --git a/gemfiles/rails_8.1.gemfile b/gemfiles/rails_8.1.gemfile new file mode 100644 index 0000000..4c6d24e --- /dev/null +++ b/gemfiles/rails_8.1.gemfile @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +gem "rails", "~> 8.1.0" + +gemspec path: "../" diff --git a/mise.toml b/mise.toml index eea8e5e..fca38df 100644 --- a/mise.toml +++ b/mise.toml @@ -1,2 +1,2 @@ [tools] -ruby = "4.0.2" +ruby = "4.0.9" diff --git a/ruby_ui_scaffold.gemspec b/ruby_ui_scaffold.gemspec index b8ff783..fc350e1 100644 --- a/ruby_ui_scaffold.gemspec +++ b/ruby_ui_scaffold.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |spec| "to ruby_ui components (Input, Textarea, Checkbox, Button, Table, FormField, etc.)." spec.homepage = "https://github.com/jacksonpires/ruby_ui_scaffold" spec.license = "MIT" - spec.required_ruby_version = ">= 3.1.0" + spec.required_ruby_version = ">= 3.2.0" spec.metadata["homepage_uri"] = spec.homepage spec.metadata["source_code_uri"] = spec.homepage