summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndré Arko <andre@arko.net>2012-06-07 11:18:25 -0700
committerAndré Arko <andre@arko.net>2012-06-07 11:18:25 -0700
commit9791f47046ac45576f0a13b3dda8e182d812700b (patch)
treefcdd8cdfd46fb302a10b14f35b5dabc84d4d5790 /lib
parentc6667544537e5a61a462fa532afa108868ca5145 (diff)
parentf4dc6c5d4d636c270df8e5423bce6d9b1f08a715 (diff)
downloadbundler-9791f47046ac45576f0a13b3dda8e182d812700b.tar.gz
Merge pull request #1920 from drogus/gem_path_fix
Always try to keep original GEM_PATH
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler.rb2
-rw-r--r--lib/bundler/gem_path_manipulation.rb8
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 8c325dac93..833b110c29 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -1,12 +1,14 @@
require 'rbconfig'
require 'fileutils'
require 'pathname'
+require 'bundler/gem_path_manipulation'
require 'bundler/psyched_yaml'
require 'bundler/rubygems_ext'
require 'bundler/rubygems_integration'
require 'bundler/version'
module Bundler
+ preserve_gem_path
ORIGINAL_ENV = ENV.to_hash
autoload :Definition, 'bundler/definition'
diff --git a/lib/bundler/gem_path_manipulation.rb b/lib/bundler/gem_path_manipulation.rb
new file mode 100644
index 0000000000..628d954c35
--- /dev/null
+++ b/lib/bundler/gem_path_manipulation.rb
@@ -0,0 +1,8 @@
+module Bundler
+ def self.preserve_gem_path
+ original_gem_path = ENV["_ORIGINAL_GEM_PATH"]
+ gem_path = ENV["GEM_PATH"]
+ ENV["_ORIGINAL_GEM_PATH"] = gem_path if original_gem_path.nil? || original_gem_path == ""
+ ENV["GEM_PATH"] = original_gem_path if gem_path.nil? || gem_path == ""
+ end
+end