Ruby stack ignores .ruby-version (and the Gemfile `ruby` directive)
Our Ruby buildpack never reads any Ruby version source. It defaults to a hardcoded "3.2" and only overrides it from [build] version in .miren/app.toml. There's no detection of .ruby-version or the ruby "x.y" directive in the Gemfile, so users who bump their Ruby version the normal way see no effect and stay on 3.2.9. The Go stack already does this correctly (parses go.mod), so Ruby is just missing the equivalent wiring.
Surfaced by a user (Javier, in Discord) trying to upgrade hanami-demo to hanami 3.0, which needs Ruby >= 3.3. Three things bit him in sequence: setting .ruby-version did nothing, and then adding ruby file: ".ruby-version" to the Gemfile broke the build entirely because we don't stage that file before bundle install.
Three fixes, roughly in priority order:
- Read the version. Add a
parseRubyVersion()toRubyStackthat checks.ruby-versionand the Gemfilerubydirective, wired into theopts.Version → detected → defaultfallback. MirrorGoStack.parseGoModVersion(pkg/stackbuild/golang.go:155, used atgolang.go:185-188). Detection belongs inRubyStack.Init(pkg/stackbuild/ruby.go:121); the default lives atruby.go:216. - Stage
.ruby-versionbefore bundle install.bundleInstallonly copiesGemfile*into the layer (pkg/stackbuild/stackbuild.go:312), so Gemfiles that doruby file: ".ruby-version"fail with "Could not find version file .ruby-version." The full context (including.ruby-version) isn't copied untilcopyAppatruby.go:239, one step too late. Add.ruby-versionto the early copy. - Bump the stale default.
"3.2"predates infra only mirroring 3.3/3.4/4.0 (infra/image-sync/images.yaml), so a bareruby:3.2-slimmay not even be synced. Bump to"3.4".
Once 1 and 2 land, an untouched repo with .ruby-version + ruby file: ".ruby-version" builds correctly with zero miren-specific config.
Workaround for now: drop the ruby file: line and set [build] version = "3.4" in .miren/app.toml.