Skip to content

Commit 3b08792

Browse files
committed
Enforce use of Bundler >= 2.4
We make use of `install_if` in our appraisals. However, if you aren't using Bundler 2.4 then you can't generate any appraisal gemfiles. This commit enforces the correct version of Bundler by adding a check to the Gemfile itself. This isn't ideal, but we can't simply add `gem "bundler", "~> 2.4"` to the Gemfile because of the new-ish logic in Bundler which [automatically switches to the version of Bundler specified by the `BUNDLED WITH` section in the lockfile][1]. Unfortunately, we can't commit the lockfiles to the repo, so neither adding the `gem` line nor updating the `BUNDLED WITH` would work. [1]: https://bundler.io/blog/2022/01/23/bundler-v2-3.html
1 parent 5b6f8e1 commit 3b08792

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# frozen_string_literal: true
22

3+
if !Gem::Requirement.new(">= 2.4").satisfied_by?(
4+
Gem::Version.new(Bundler::VERSION)
5+
)
6+
raise "Bundler >= 2.4 is required. Please update Bundler by running `bundle update --bundler`"
7+
end
8+
39
source "https://rubygems.org"
410

511
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

bin/setup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ ensure-project-ruby-dependencies-installed() {
267267
if [[ $USE_BUNDLER_1 -eq 1 ]] && (! has-bundler || ! [[ $(bundle -v) =~ '^Bundler version 1\.' ]]); then
268268
gem install bundler:'~> 1.0'
269269
elif ! has-bundler; then
270-
gem install bundler
270+
gem install bundler:'>= 2.4.0'
271271
fi
272272

273273
bundle check || bundle install

0 commit comments

Comments
 (0)