Open eliotsykes opened 9 months ago
ruby File.read(".ruby-version")
works well (if you didn't know)
Thanks @dentarg 👍. Yes, I've used and liked that technique for some time too.
It works well for .ruby-version
, although not so well for .tool-versions
which requires a bit more work:
ruby(/^ruby\s(.*)$/.match(File.read(".tool-versions"))[1].strip)
Feature requests are the number 1 reason (after bug fixes) for us to rev the bundler version. So thanks for letting me know you want it!
As an FYI In the future https://github.com/heroku/buildpacks-ruby will eventually replace this buildpack (a long way off). It pulls the bundler version from the Gemfile.lock instead of using this "blessed" system, which I would like to move away from.
Timing-wise, I'm unsure when I'll be able to get this out. I'm mindful that a lot of companies have holidays coming up and a 1 in a million bug for bundler shows up pretty often for us (so I want to balance out stability, even if there's no known cause for concern).
To recap: Yes, I'll upgrade for sure. No commitment on the timeline, though.
+1 for this. We recently switched to the new DSL in Gemfile but had to revert the change until the buildpack can support it. Thanks for looking into it @schneems!
@schneems you might want to get to this before the next Rails release? If that release will include https://github.com/rails/rails/pull/49360
Submitted ticket #1349048 to Heroku support about this
I've verified deployment works now (using ruby file: '.tool-versions'
in the Gemfile, Bundler 2.5.7). Looks like this can be closed.
We seem to still get errors when detecting rake tasks. Initially it is able to install all gems, but it fails on a later step.
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.5.6
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-3.2.2
remote: -----> Installing dependencies using bundler 2.5.6
#snip: Removed a lot of gem install lines
remote: Bundle completed (88.59s)
remote: Cleaning up the bundler cache.
remote: Removing bundler (2.5.6)
remote: -----> Detecting rake tasks
remote:
remote: !
remote: ! Could not detect rake tasks
remote: ! ensure you can run `$ bundle exec rake -P` against your app
remote: ! and using the production group of your Gemfile.
remote: ! /tmp/build_91067714/vendor/ruby-3.2.2/lib/ruby/3.2.0/bundler/definition.rb:442:in `validate_ruby!': Your Ruby version is 3.2.2, but your Gemfile specified (Bundler::RubyVersionMismatch)
bundle exec rake -P
works fine locally.
@schneems I think this issue can be closed now
It'd be handy for the Heroku Ruby buildpack to enable using the
ruby file: ...
option inGemfile
by supporting Bundler 2.4.20.This was introduced in Bundler 2.4.19:
Bundler 2.4.20 improved on this to support more formats, including
.tool-versions
:Changelog entry: https://github.com/rubygems/rubygems/blob/master/bundler/CHANGELOG.md#2420-september-27-2023