From e2b20cbbe681415ff50014a479f2498ba2e33978 Mon Sep 17 00:00:00 2001 From: Schneems Date: Thu, 30 Jan 2025 17:21:35 -0600 Subject: [PATCH] Bundler default version now 2.3.x Bundler 1.x is not able to run with Ruby 3.3 in some circumstances: ``` remote: ! There was an error parsing your Gemfile, we cannot continue remote: ! /tmp/d20250127-138-l8vq2r/bundler-1.17.3/gems/bundler-1.17.3/lib/bundler/shared_helpers.rb:29:in `root': undefined method `untaint' for an instance of Pathname (NoMethodError) remote: ! remote: ! Pathname.new(gemfile).untaint.expand_path.parent ``` This commit updates the default bundler version to 2.3.x. --- CHANGELOG.md | 1 + changelogs/unreleased/bundler_default.md | 13 +++++++++++++ lib/language_pack/helpers/bundler_wrapper.rb | 6 +++++- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/bundler_default.md diff --git a/CHANGELOG.md b/CHANGELOG.md index c12b42d2c..682ca72b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] - Default Ruby version is now 3.3.7 (https://github.com/heroku/heroku-buildpack-ruby/pull/1534) +- Default bundler version (when no version present in the `Gemfile.lock`) is now bundler `2.3.x` which is currently `2.3.25` (https://github.com/heroku/heroku-buildpack-ruby/pull/1534) ## [v288] - 2025-01-06 diff --git a/changelogs/unreleased/bundler_default.md b/changelogs/unreleased/bundler_default.md new file mode 100644 index 000000000..03f692719 --- /dev/null +++ b/changelogs/unreleased/bundler_default.md @@ -0,0 +1,13 @@ +## Ruby applications with no specified bundler versions now receive Bundler 2.x + +Previously applications with no `BUNDLED WITH` in their `Gemfile.lock` would receive bundler `1.x`. They will now receive the new [default bundler version](https://devcenter.heroku.com/articles/ruby-support-reference#default-bundler-version) `2.3.x`. + +It is strongly recommended that you have both a `RUBY VERSION` and `BUNDLED WITH` version listed in your `Gemfile.lock`. If you do not have those values, you can generate them and commit them to git: + +``` +$ bundle update --ruby +$ git add Gemfile.lock +$ git commit -m "Update Gemfile.lock" +``` + +Applications without these values specified in the `Gemfile.lock` may break unexpectedly when the defaults change. diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 78c3a119c..fdf2cc5a7 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -42,6 +42,10 @@ class LanguagePack::Helpers::BundlerWrapper BLESSED_BUNDLER_VERSIONS["2.4"] = "2.4.22" BLESSED_BUNDLER_VERSIONS["2.5"] = "2.5.23" BLESSED_BUNDLER_VERSIONS["2.6"] = "2.6.2" + + DEFAULT_VERSION = BLESSED_BUNDLER_VERSIONS["2.3"] + + # Convert arbitrary `..x` versions BLESSED_BUNDLER_VERSIONS.default_proc = Proc.new do |hash, key| if Gem::Version.new(key).segments.first == 1 hash["1"] @@ -65,7 +69,7 @@ def self.detect_bundler_version(contents: ) minor = version_match[:minor] BLESSED_BUNDLER_VERSIONS["#{major}.#{minor}"] else - BLESSED_BUNDLER_VERSIONS["1"] + DEFAULT_VERSION end end