summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-08-19 18:17:47 -0400
committerSamuel Giddins <segiddins@segiddins.me>2017-08-25 15:56:23 -0400
commit85a5d361d06694e96e91c7f833c746803699342a (patch)
treea5aef2c83ce284894f6c199ce6a5293d1260984d
parent3203fdd2ad861af2aedfa233b754a02bfc1c4741 (diff)
downloadbundler-85a5d361d06694e96e91c7f833c746803699342a.tar.gz
When the locked bundler is under 2.0, allow any version < 2
-rw-r--r--lib/bundler/templates/Executable.bundler3
-rw-r--r--spec/commands/binstubs_spec.rb14
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/bundler/templates/Executable.bundler b/lib/bundler/templates/Executable.bundler
index 085955c7a9..ccb9627ca5 100644
--- a/lib/bundler/templates/Executable.bundler
+++ b/lib/bundler/templates/Executable.bundler
@@ -66,6 +66,9 @@ m = Module.new do
end
def activate_bundler(bundler_version)
+ if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
+ bundler_version = "< 2"
+ end
gem_error = activation_error_handling do
gem "bundler", bundler_version
end
diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb
index fa44928625..decf361d1d 100644
--- a/spec/commands/binstubs_spec.rb
+++ b/spec/commands/binstubs_spec.rb
@@ -107,19 +107,21 @@ RSpec.describe "bundle binstubs <gem>" do
end
it "runs the correct version of bundler when the version is older" do
- lockfile lockfile.gsub(system_bundler_version, "1.0")
+ simulate_bundler_version "55"
+ lockfile lockfile.gsub(system_bundler_version, "44.0")
sys_exec "#{bundled_app("bin/bundle")} install"
expect(exitstatus).to eq(42) if exitstatus
- expect(last_command.stderr).to include("Activating bundler (1.0) failed:").
- and include("To install the version of bundler this project requires, run `gem install bundler -v '1.0'`")
+ expect(last_command.stderr).to include("Activating bundler (44.0) failed:").
+ and include("To install the version of bundler this project requires, run `gem install bundler -v '44.0'`")
end
it "runs the correct version of bundler when the version is a pre-release" do
- lockfile lockfile.gsub(system_bundler_version, "1.12.0.a")
+ simulate_bundler_version "55"
+ lockfile lockfile.gsub(system_bundler_version, "2.12.0.a")
sys_exec "#{bundled_app("bin/bundle")} install"
expect(exitstatus).to eq(42) if exitstatus
- expect(last_command.stderr).to include("Activating bundler (1.12.0.a) failed:").
- and include("To install the version of bundler this project requires, run `gem install bundler -v '1.12.0.a'`")
+ expect(last_command.stderr).to include("Activating bundler (2.12.0.a) failed:").
+ and include("To install the version of bundler this project requires, run `gem install bundler -v '2.12.0.a'`")
end
end