Suppose I've cloned a git repository for a gem. They have a Gemfile, but no Gemfile.lock, because it's common practice to not check that in for gems. The Gemfile looks something like this:
source "https://rubygems.org"
gem "bundler", "~> 1.0"
Alternatively, the Gemfile could contain gemspec and the gemspec could specify Bundler as a dependency or development dependency.
If I have Bundler 2.x installed, when I run bundle to install the dependencies, I get an error like this:
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 Gemfile:
bundler (~> 1.0)
Current Bundler version:
bundler (2.0.1)
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.0)' in any of the relevant sources:
the local ruby installation
If there were a lockfile, this wouldn't happen, because BUNDLED WITH would be set appropriately and autoswitching would kick in, but if there's no lockfile, version autoswitching doesn't happen. I propose that, if there's no lockfile, the Gemfile should be read to see if a Bundler version is specified there.
I'm happy to work on implementing this myself, but wanted to first open an issue to check whether you maintainers would like to see this implemented, or whether you prefer to leave things as they are.
Suppose I've cloned a git repository for a gem. They have a Gemfile, but no Gemfile.lock, because it's common practice to not check that in for gems. The Gemfile looks something like this:
Alternatively, the Gemfile could contain
gemspecand the gemspec could specify Bundler as a dependency or development dependency.If I have Bundler 2.x installed, when I run
bundleto install the dependencies, I get an error like this:If there were a lockfile, this wouldn't happen, because
BUNDLED WITHwould be set appropriately and autoswitching would kick in, but if there's no lockfile, version autoswitching doesn't happen. I propose that, if there's no lockfile, the Gemfile should be read to see if a Bundler version is specified there.I'm happy to work on implementing this myself, but wanted to first open an issue to check whether you maintainers would like to see this implemented, or whether you prefer to leave things as they are.