appraisal
appraisal copied to clipboard
support multiple bundler versions
i've got this Appraisals:
appraise "rails-5.0" do
gem "rails", "~> 5.0.0"
end
appraise "rails-5.1" do
gem "rails", "~> 5.1.0"
end
appraise "rails-5.2" do
gem "rails", "~> 5.2.0"
end
appraise "rails-6.0" do
gem "rails", "~> 6.0.0"
end
appraise "rails-6.1" do
gem "rails", "~> 6.1.0"
end
i tried to update it recently and discovered that there's a clash with bundler
versions:
Note: Run `appraisal generate --travis` to generate Travis CI configuration.
true
>> bundle check --gemfile='/home/circleci/repo/gemfiles/rails_5.0.gemfile' || bundle install --gemfile='/home/circleci/repo/gemfiles/rails_5.0.gemfile' --retry 1
Bundler can't satisfy your Gemfile's dependencies.
Install missing gems with `bundle install`.
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
In rails_5.0.gemfile:
bundler (~> 2.1.2)
rails (~> 5.0.0) was resolved to 5.0.4, which depends on
bundler (< 2.0, >= 1.3.0)
Current Bundler version:
bundler (2.1.2)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
is there a way to specify which bundler
version is used for each appraise
block? i added the version i needed but when the bundle install
was called it still failed:
>> BUNDLE_GEMFILE=/Users/jon/git/cloudflare-rails/gemfiles/rails_5.0.gemfile bundle update
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
In rails_5.0.gemfile:
bundler (~> 1.17.3)
Current Bundler version:
bundler (2.1.4)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
Could not find gem 'bundler (~> 1.17.3)' in any of the relevant sources:
the local ruby installation
Are you running the same bundler version as the one which is specified in the .lock
file? I've seen that be a problem in the past. On CI I've had to specify it in the past when the container version and what we're using elsewhere differ.
no, that's the issue i'm trying to sort out. if i support rails 5 i'm forced to use bundler (~> 1.17.3)
everywhere. i'm looking for a way to pass in the version number to appraisal
so it uses it (eg, _2.1.4_
or whatever) in the bundle exec
call it makes. does this make sense?
Ah right, I see. I didn't find it necessary to use bundler ~> 1.17.3, but it did require some work for older Ruby versions.
Does this CircleCI config help at all? https://github.com/thoughtbot/administrate/blob/main/.circleci/config.yml
I ended up using an environment variable to set to bundler 2.1.4, so that we're using the same one for every Ruby version.
Hoping there will eventually be a way to have different bundler versions via Appraisal!
I was able to get it working!!
Working example of Appraisal & Combustion with a massive test matrix on Github Actions in my sanitize_email gem here: https://github.com/pboling/sanitize_email/commit/a9c1d9a11732b57e1b898e74516bbff36724ff97
- Ruby 2.3 - Ruby 3.3
- Rails 3.0 - Rails 7.1
- bundler 1 & bundler 2