From be71b5564273dbb60e1b0bdc75963510265bc074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Fri, 26 Apr 2019 20:00:45 +0200 Subject: [PATCH] Remove hard errors on version mismatches This is already short-circuit by rubygems' bundler version finder. --- lib/bundler/lockfile_parser.rb | 5 -- spec/lock/lockfile_spec.rb | 84 ---------------------------------- 2 files changed, 89 deletions(-) diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb index d422764909c..5658ec12050 100644 --- a/lib/bundler/lockfile_parser.rb +++ b/lib/bundler/lockfile_parser.rb @@ -101,11 +101,6 @@ def warn_for_outdated_bundler_version return unless bundler_version prerelease_text = bundler_version.prerelease? ? " --pre" : "" current_version = Gem::Version.create(Bundler::VERSION) - current_major_version = current_version.segments.first - current_locked_version = bundler_version.segments.first - if current_major_version < current_locked_version && current_major_version > 2 - raise LockfileError, "You must use Bundler #{current_locked_version} or greater with this lockfile." - end return unless current_version < bundler_version Bundler.ui.warn "Warning: the running version of Bundler (#{current_version}) is older " \ "than the version that created the lockfile (#{bundler_version}). We suggest you to " \ diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb index 0721f83077f..7005d7a05ce 100644 --- a/spec/lock/lockfile_spec.rb +++ b/spec/lock/lockfile_spec.rb @@ -204,86 +204,6 @@ G end - it "warns if the current major version is older than lockfile's major version", :bundler => "< 3" do - current_version = Bundler::VERSION - newer_major = bump_major(current_version) - - lockfile <<-L - GEM - remote: file://localhost#{gem_repo1}/ - specs: - rack (1.0.0) - - PLATFORMS - #{lockfile_platforms} - - DEPENDENCIES - rack - - BUNDLED WITH - #{newer_major} - L - - install_gemfile <<-G - source "file://localhost#{gem_repo1}" - - gem "rack" - G - - pre_flag = prerelease?(newer_major) ? " --pre" : "" - warning_message = "the running version of Bundler (#{current_version}) is older " \ - "than the version that created the lockfile (#{newer_major}). " \ - "We suggest you to upgrade to the version that created the " \ - "lockfile by running `gem install bundler:#{newer_major}#{pre_flag}`." - expect(last_command.stderr).to include warning_message - - lockfile_should_be <<-G - GEM - remote: file://localhost#{gem_repo1}/ - specs: - rack (1.0.0) - - PLATFORMS - #{lockfile_platforms} - - DEPENDENCIES - rack - - BUNDLED WITH - #{newer_major} - G - end - - it "errors if the current major version is older than lockfile's bundler version", :bundler => "3" do - current_version = Bundler::VERSION - newer_major = bump_major(current_version) - - lockfile <<-L - GEM - remote: file://localhost#{gem_repo1}/ - specs: - rack (1.0.0) - - PLATFORMS - #{lockfile_platforms} - - DEPENDENCIES - rack - - BUNDLED WITH - #{newer_major} - L - - install_gemfile <<-G - source "file://localhost#{gem_repo1}/" - - gem "rack" - G - - expect(last_command).to be_failure - expect(err).to include("You must use Bundler #{newer_major.split(".").first} or greater with this lockfile.") - end - it "warns when updating bundler major version" do current_version = Bundler::VERSION older_major = previous_major(current_version) @@ -1562,10 +1482,6 @@ def previous_major(version) version.split(".").map.with_index {|v, i| i == 0 ? v.to_i - 1 : v }.join(".") end - def bump_major(version) - bump(version, 0) - end - def bump_minor(version) bump(version, 1) end