From 64bc84e82692dd2e6b65c19e5cb42e41ef8852f1 Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Fri, 5 Aug 2016 10:51:41 -0500 Subject: [Setup] Only add bundler to the load path if we havent trampolined --- lib/bundler/postit_trampoline.rb | 6 +++--- lib/bundler/setup.rb | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/bundler/postit_trampoline.rb b/lib/bundler/postit_trampoline.rb index 950a77341f..dbb23aa4d9 100644 --- a/lib/bundler/postit_trampoline.rb +++ b/lib/bundler/postit_trampoline.rb @@ -53,9 +53,9 @@ The error was: #{e} nil end - if Gem::Requirement.new(">= 1.13.pre".dup).satisfied_by?(Gem::Version.new(running_version)) - ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"] = installed_version.to_s - elsif ARGV.empty? || ARGV.any? {|a| %w(install i).include? a } + ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"] = installed_version.to_s + + if !Gem::Requirement.new(">= 1.13.pre".dup).satisfied_by?(Gem::Version.new(running_version)) && (ARGV.empty? || ARGV.any? {|a| %w(install i).include? a }) puts <<-WARN.strip You're running Bundler #{installed_version} but this project uses #{running_version}. To update, run `bundle update --bundler`. WARN diff --git a/lib/bundler/setup.rb b/lib/bundler/setup.rb index c888dabf2c..8b4b479778 100644 --- a/lib/bundler/setup.rb +++ b/lib/bundler/setup.rb @@ -20,9 +20,12 @@ if Bundler::SharedHelpers.in_bundle? Bundler.setup end - # Add bundler to the load path after disabling system gems - bundler_lib = File.expand_path("../..", __FILE__) - $LOAD_PATH.unshift(bundler_lib) unless $LOAD_PATH.include?(bundler_lib) + unless ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"] + # Add bundler to the load path after disabling system gems + # This is guarenteed to be done already if we've trampolined + bundler_lib = File.expand_path("../..", __FILE__) + $LOAD_PATH.unshift(bundler_lib) unless $LOAD_PATH.include?(bundler_lib) + end Bundler.ui = nil end -- cgit v1.2.1