Skip to content

Hardcode Gemfile.next for test deploy branch#3

Open
fbuys wants to merge 2 commits intoadd_gemfile_next_supportfrom
use_gemfile_next
Open

Hardcode Gemfile.next for test deploy branch#3
fbuys wants to merge 2 commits intoadd_gemfile_next_supportfrom
use_gemfile_next

Conversation

@fbuys
Copy link
Copy Markdown
Member

@fbuys fbuys commented Apr 21, 2026

As a debugging tool when BUNDLE_GEMFILE does not seem to take effect. It can also be used to deploy the next rails version without setting BUNDLE_GEMFILE.

Force BundlerWrapper and ruby.rb to use Gemfile.next/.lock instead of the BUNDLE_GEMFILE env var or the default Gemfile. Removes the now-unused current_gemfile/gemfile_path/gemfile_lock_path helpers from ruby.rb.

Note: self.use? still detects via Gemfile — the test app must include a Gemfile for buildpack detection to trigger.

Deployment steps:

  1. Make sure your app can boot with the Gemfile.next.lock file locally.
  2. Go to the Buildpacks section and remove the heroku/ruby buildpack from your app and add https://github.com/fastruby/heroku-buildpack-ruby#use_gemfile_next
  3. Deploy your app to Heroku.
  4. The build and release logs should confirm that the correct Rails version is deployed.

@fbuys fbuys force-pushed the use_gemfile_next branch from 6b0e681 to 4f8f3cd Compare April 24, 2026 13:41
As a debugging tool when BUNDLE_GEMFILE does not seem to take effect.
It can also be used to deploy the next rails version without setting
BUNDLE_GEMFILE.

Force BundlerWrapper and ruby.rb to use Gemfile.next/.lock
instead of the BUNDLE_GEMFILE env var or the default Gemfile.
Removes the now-unused current_gemfile/gemfile_path/gemfile_lock_path
helpers from ruby.rb.

Build phase (compile() flow)
- setup_language_pack_environment sets ENV["BUNDLE_GEMFILE"] =
"#{build_path}/Gemfile.next"
→ used by build_bundler (which also hardcodes it via env_vars at line
802, consistent)
- post_bundler → bundler.clean then resets ENV back to nil (this is why
setup_export must hardcode the path, not read from ENV)

Export for subsequent buildpacks (setup_export)
- Hardcodes "#{build_path}/Gemfile.next" directly — immune to
bundler.clean resetting ENV to nil
- Writes export
BUNDLE_GEMFILE="${BUNDLE_GEMFILE:-/tmp/build_.../Gemfile.next}" to the export file

Runtime + release phase (setup_profiled)
- set_env_override "BUNDLE_GEMFILE", "$HOME/Gemfile.next" writes export
BUNDLE_GEMFILE="$HOME/Gemfile.next" to .profile.d/ruby.sh
- Heroku sources .profile.d/ before running release commands and at
every dyno startup, so both the release phase (rake db:migrate etc.)
and running dynos get BUNDLE_GEMFILE=/app/Gemfile.next

Note: self.use? still detects via Gemfile — the test app must include a
Gemfile for buildpack detection to trigger.
@fbuys fbuys force-pushed the use_gemfile_next branch from 4f8f3cd to 8930350 Compare April 28, 2026 15:45
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.

1 participant