From 5962d74970f056f7ae01236be9afc73b1a4c2fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Fri, 22 Mar 2019 22:51:30 +0100 Subject: [PATCH] Partially restore hack --- lib/bundler/version.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index 21eeeb0fd4f..deedf9106ac 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -3,6 +3,24 @@ module Bundler VERSION = "2.1.0.pre.1".freeze + if ENV["BUNDLE_SPEC_RUN"] + # We're doing this because we might write tests that deal + # with other versions of bundler and we are unsure how to + # handle this better. + def self.overwrite_loaded_gem_version + begin + require "rubygems" + rescue LoadError + return + end + return unless bundler_spec = Gem.loaded_specs["bundler"] + return if bundler_spec.version == VERSION + bundler_spec.version = Bundler::VERSION + end + private_class_method :overwrite_loaded_gem_version + overwrite_loaded_gem_version + end + def self.bundler_major_version @bundler_major_version ||= VERSION.split(".").first.to_i end