Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Bundler 2.4.20+ to enable ruby file: '.ruby-version' in Gemfile #1408

Open
eliotsykes opened this issue Dec 2, 2023 · 9 comments
Open

Comments

@eliotsykes
Copy link

eliotsykes commented Dec 2, 2023

It'd be handy for the Heroku Ruby buildpack to enable using the ruby file: ... option in Gemfile by supporting Bundler 2.4.20.

This was introduced in Bundler 2.4.19:

ruby file: '.ruby-version'

Bundler 2.4.20 improved on this to support more formats, including .tool-versions:

ruby file: '.tool-versions'

Changelog entry: https://github.com/rubygems/rubygems/blob/master/bundler/CHANGELOG.md#2420-september-27-2023

@dentarg
Copy link

dentarg commented Dec 2, 2023

ruby File.read(".ruby-version") works well (if you didn't know)

@eliotsykes
Copy link
Author

eliotsykes commented Dec 2, 2023

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)

@schneems
Copy link
Contributor

schneems commented Dec 5, 2023

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.

@janklimo
Copy link

+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!

@dentarg
Copy link

dentarg commented Feb 14, 2024

@schneems you might want to get to this before the next Rails release? If that release will include rails/rails#49360

@dentarg
Copy link

dentarg commented Feb 20, 2024

Submitted ticket #1349048 to Heroku support about this

@janklimo
Copy link

I've verified deployment works now (using ruby file: '.tool-versions' in the Gemfile, Bundler 2.5.7). Looks like this can be closed.

@erikaxel
Copy link

erikaxel commented Apr 3, 2024

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.

@dentarg
Copy link

dentarg commented May 14, 2024

@schneems I think this issue can be closed now

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 a pull request may close this issue.

5 participants