Repository navigation
1.0.0: Rails 8 only, sqlite3 + Solid + Thruster/Falcon + Minitest - #19
Merged
Merged
Conversation
Default stack is now sqlite3 + Solid (Queue/Cache/Cable) + falcon-rails, with RuboCop inheriting rubocop-rails-omakase and annotate replaced by annotaterb. - generator: -d defaults to sqlite3, --skip-solid defaults to false, annotate:install -> annotate_rb:install - builder: remove config/puma.rb and rewrite bin/dev to run `falcon serve`; rename configure_puma_dev -> configure_dev_hosts - Gemfile template: filter puma out of gemfile_entries, add falcon-rails, and re-declare what Rails puts in its own Gemfile template (solid_*, kamal, rubocop-rails-omakase) since we replace that file wholesale; fix deprecated bundler platform names - rubocop template: inherit_gem rubocop-rails-omakase + plugins:, and drop `TargetRubyVersion: <%= RUBY_VERSION %>` which produced an invalid "4.0.6" on Ruby 4.0 and made RuboCop fail to load - lint generator: stop skipping itself on Rails 8+; write .rubocop.yml with force: true to overwrite the one Rails generates - gitlab-ci: only emit `services:` when pg or mysql is in use - gitignore: ignore storage/*.sqlite3* produced by Solid - gemspec: unpin ancient dev deps (rake ~> 13, rubocop ~> 1.90, simplecov ~> 0.22) so `bundle exec` works on Ruby 4.0 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
falcon-rails depends on rails >= 8.0, so declaring it unconditionally broke `bundle install` for the whole Rails 7.x CI matrix. Gate the falcon swap on Rails 8+: Rails 7 apps keep puma in the Gemfile and keep config/puma.rb. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`File.expand_path("#{Pathname.new(__FILE__).dirname}../lib")` was missing a
separator and produced `<root>/exe../lib`, a path that does not exist. Since
it was also appended rather than prepended, `ruby exe/bankai` silently ran
whichever bankai gem was installed instead of the working copy — which makes
testing local changes to the generator impossible.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Generated projects now use Rails' built-in Minitest instead of RSpec, keeping
the surrounding tooling: factory_bot_rails, faker, shoulda-matchers (plus
shoulda-context for the `should` macro), database_rewinder and simplecov.
- `--skip-rspec` is gone; `--skip-test` now defaults to false and gates the
whole testing generator
- templates/test_helper.rb replaces the one Rails generates, and
test/support/{coverage,shoulda_matchers,database_rewinder}.rb are copied in;
use_transactional_tests is off since DatabaseRewinder does the cleaning, so
there are no fixtures to preserve
- rubocop-rspec -> rubocop-minitest, and .gitlab-ci.yml runs `bin/rails test`
- scaffolded dirs are now test/factories, test/requests, test/support/*
Rails 7 support is dropped (falcon-rails needs Rails >= 8.0, so Rails 7 was
already on a degraded path), which removes every version branch:
- gemspec floor is rails >= 8.0.0; CI matrix is Ruby 3.2/3.3/3.4/4.0 x Rails
8.0/8.1
- falcon/solid/kamal declarations and remove_puma_config are unconditional
- SUPPORTED_DATABASES collapses to Rails::Generators::Database::DATABASES
- Base#app_name drops the pre-Rails-6 fallback
- gitignore drops the `options.skip_yarn?` block (removed from Rails)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This release changes the generated stack (sqlite3 + Solid + falcon + Minitest) and drops Rails 7, so it is not backwards compatible with 0.14. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The generated Gemfile asked for `gem 'bankai'` with no version requirement, so running an unreleased `exe/bankai` without `--path` resolved to whatever bankai was published and ran that gem's `bankai:*` sub-generators — e.g. 0.14.0's testing generator calling `rspec:install` on a 1.0 app. Pin the requirement to the running version's major.minor so this fails at `bundle install` instead of silently mixing versions. `replace_gemfile` now rewrites the whole line rather than appending to it, since a path source and a version requirement cannot both be given. Also adds CHANGELOG.md documenting 1.0.0, and expands the README's "Test Gem" section to explain what `exe/bankai` vs `--path` each control. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Rails' Dockerfile boots the app with `bin/rails server`, which cannot start Falcon: falcon-rails deliberately does not load Falcon during boot (a documented load-order hazard), so the Rackup handler is never registered and `rails server` fails with "Could not find a server gem". Since Puma is removed, the generated Dockerfile would not have booted at all. Rewrite the CMD to run `falcon serve`. Thruster is not Puma-specific, contrary to the note this removes: it is a generic proxy that execs whatever command it wraps and passes the backend port via $PORT. Two things follow: - `gem "thruster"` is now declared in the Gemfile template, so `--no-skip-thruster` actually installs it. This was the same omission as `solid_*` and `kamal` — Rails declares it in the Gemfile template we replace. - The Thruster variant of the CMD is `./bin/thrust sh -c 'exec ... --bind http://0.0.0.0:$PORT'`, so $PORT expands in the shell Thruster starts. Expanding it in a shell *wrapping* thrust reads the value before Thruster sets it, and every request 502s. Both paths verified end to end against a generated app: `GET /up` returns 200 via Falcon directly and via Thruster in front of it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Now that Thruster actually gets installed and its CMD works, front Falcon with it by default: HTTP/2, public asset caching, X-Sendfile and compression, with TLS staying off unless TLS_DOMAIN is set. Verified against a generated app with default options: `GET /up` returns 200 through Thruster to Falcon, with no proxy errors. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
以現在 Rails 8.1 + Ruby 4.0.x 的環境重整 bankai 的預設組合,並把 Rails 7 的相容路徑整個移除。Breaking,版號跳 1.0.0(見 CHANGELOG.md)。
預設值變更
annotate(已停止維護)annotaterbrubocop-rails-omakaseKamal 維持 skip。
App server:Thruster → Falcon
falcon-rails取代 puma(gemfile_entries濾掉 puma、刪config/puma.rb),Thruster 擺在前面提供 HTTP/2、public asset caching、X-Sendfile 和壓縮;不設TLS_DOMAIN就是 HTTP-only,適合部署在 Traefik/nginx 後面。bin/dev→falcon serve --bind http://localhost:3000 --count 1EXPOSE 80、CMD ["./bin/thrust", "sh", "-c", "exec bundle exec falcon serve --bind http://0.0.0.0:$PORT"]測試框架
改用 Rails 內建的 Minitest,周邊工具保留:factory_bot_rails、faker、shoulda-matchers、database_rewinder、simplecov(+cobertura)。另外加了
shoulda-context,否則should validate_presence_of(:name)這個 macro 在 Minitest 下不存在。templates/test_helper.rb覆寫 Rails 產的版本;test/support/{coverage,shoulda_matchers,database_rewinder}.rb一併帶入fixtures :all直接衝突,所以use_transactional_tests = false、測試資料全走 factory(與原本 RSpec 那套設定行為一致)rubocop-rspec→rubocop-minitest,.gitlab-ci.yml改跑bin/rails test--skip-rspec移除,改由--skip-test(預設 false)控制test/factories、test/requests、test/support/{matchers,mixins}移除 Rails 7 support
falcon-rails的 gemspec 是rails >= 8.0,Rails 7 本來就只能走降級路徑。拿掉之後所有版本分支都消失了:rails >= 8.0.0;CI matrix 改為 Ruby 3.2/3.3/3.4/4.0 × Rails 8.0/8.1remove_puma_config變無條件SUPPORTED_DATABASES三層 fallback →Rails::Generators::Database::DATABASESBase#app_name拿掉 pre-Rails-6 的parent_name分支gitignore.erb拿掉options.skip_yarn?區塊(Rails 已移除該選項)順帶修掉的 bug
CMD ["./bin/rails", "server"]沒辦法跑 falcon —falcon-rails明文避免在 boot 時require "falcon"(load order hazard),所以 Rackup handler 不會註冊,bin/rails server回Could not find a server gem;而 puma 已被移除。改由Builder#rewrite_dockerfile_cmd改寫成直接跑falcon serve。./bin/thrust sh -c '... $PORT',讓$PORT在 Thruster 啟的 shell 裡展開;包在 thrust 外面展開會取到 Thruster 設定前的值,每個 request 都 502。templates/Gemfile.erb整份取代 Rails 自己的 Gemfile template,所以 Rails 寫死在那裡的solid_*/kamal/thruster/rubocop-rails-omakase全部掉光 → 補回來(不補的話--no-skip-solid會在solid_cache:install炸掉,--no-skip-thruster則是根本沒裝到 thruster)。exe/bankai的 load path 算錯:"#{Pathname.new(__FILE__).dirname}../lib"少一個分隔符,產生<root>/exe../lib這個不存在的路徑,而且是<<而非unshift— 所以ruby exe/bankai一直在跑已安裝的 bankai gem 而不是 working copy,本機改 generator 根本測不到。--path時,app 會安靜地裝上舊版並執行它的bankai:*sub-generator(例如 0.14.0 的 testing generator 對 1.0 的 app 跑rspec:install)。改成 pin~> <major>.<minor>,這種情況會直接停在bundle install。--path則改為整行取代,因為 path source 和 version requirement 不能並存。.rubocop.yml的TargetRubyVersion: <%= RUBY_VERSION %>在 Ruby 4.0.6 下會產生4.0.6,但 RuboCop 只接受major.minor→ 產出的專案 RuboCop 直接載入失敗。改由 omakase 決定。%i[mingw mswin x64_mingw]已 deprecated →%i[windows jruby]/%i[mri windows]。rake ~> 12.0、rubocop ~> 1.8.1),在 Ruby 4.0 下bundle exec直接掛掉 → rake ~> 13 / rubocop ~> 1.90 / simplecov ~> 0.22。services:key → 包進if pg? || mysql?。add_filterdeprecation →skip。其他
CHANGELOG.md(Keep a Changelog 格式,1.0.0 起算)exe/bankai與--path各自決定什麼驗證
bundle exec rspec→ 48 examples, 0 failures;bundle exec rubocop lib/ exe/→ 0 offensesfalcon-rails/thruster/solid_*/annotaterb/shoulda-*/factory_bot_railsconfig/puma.rb已移除,bin/dev執行falcon servebundle exec rubocop→ 29 files inspected, no offensesGET /up→ 200,兩條路徑都測:falcon 直接跑、以及 Thruster 在前面(無 proxy error)3 runs, 4 assertions, 0 failures,涵蓋 shoulda-matchers 的shouldmacro、factory_bot + Faker、以及 DatabaseRewinder 的跨 test 清理CI=1 GITLAB_CI=1 bin/rails test確認產出coverage/coverage.xml🤖 Generated with Claude Code