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 multiple bundler versions #179

Open
modosc opened this issue Mar 10, 2021 · 5 comments
Open

support multiple bundler versions #179

modosc opened this issue Mar 10, 2021 · 5 comments

Comments

@modosc
Copy link

modosc commented Mar 10, 2021

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
@nickcharlton
Copy link
Member

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.

@modosc
Copy link
Author

modosc commented Jun 25, 2021

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?

@nickcharlton
Copy link
Member

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.

@pboling
Copy link
Contributor

pboling commented Apr 24, 2024

Hoping there will eventually be a way to have different bundler versions via Appraisal!

@pboling
Copy link
Contributor

pboling commented Apr 28, 2024

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: pboling/sanitize_email@a9c1d9a

  • Ruby 2.3 - Ruby 3.3
  • Rails 3.0 - Rails 7.1
  • bundler 1 & bundler 2

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

No branches or pull requests

3 participants