summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-03-21 15:12:35 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-05-12 09:25:07 -0400
commitc675b59e8f7e3b4102cf0e83598b4df23691f209 (patch)
tree6e9156e75788ed3f68185254657ca93e932d182b
parent16281721fb0210b5dd480a77f988474055dc3813 (diff)
downloadbundler-remove_version_overwriting_hacks_from_regular_runtime.tar.gz
By doing this we avoid circular requires (`rubygems` requires `bundler` via `USE_GEMDEPS`, `bundler` requires `rubygems` when loading its own version), and also redefinition warnings when the `bundler.gemspec` is evaluated with `rubygems` already loaded (for example, when running `ruby setup.rb` from `rubygems` repo). But most importantly, we avoid leaking from a bundler installation to a different one, something quite common since bundler is a default gem. The previous hack meant acting like that didn't happen, but seems actually quite dangerous. We can do this due to the previous work of making all of bundler internal requires not rely on the LOAD_PATH, and thus making it impossible to leak to another copy of bundler.
-rw-r--r--lib/bundler/version.rb18
1 files changed, 1 insertions, 17 deletions
diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb
index cfd6300950..21eeeb0fd4 100644
--- a/lib/bundler/version.rb
+++ b/lib/bundler/version.rb
@@ -1,23 +1,7 @@
# frozen_string_literal: false
module Bundler
- # 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.
- VERSION = "2.1.0.pre.1".freeze unless defined?(::Bundler::VERSION)
-
- 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
+ VERSION = "2.1.0.pre.1".freeze
def self.bundler_major_version
@bundler_major_version ||= VERSION.split(".").first.to_i