summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-09-08 13:57:26 -0700
committerAndre Arko <andre@arko.net>2015-09-08 13:57:26 -0700
commit3ae70bb74e290b94875732a30e5de379279e5bf9 (patch)
tree1c63f24f8e61351916ce516821a34fa23ba59f52
parent1131091bbe0c300ccc69c2cec0ff6be398af57bf (diff)
downloadbundler-3982-clean-rubylib.tar.gz
Clean RUBYLIB as well in `with_clean_env`3982-clean-rubylib
This still needs tests to ensure that `with_clean_env` does the right thing. refs #3982
-rw-r--r--lib/bundler.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 7059830a46..f16f944c5f 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -236,12 +236,19 @@ module Bundler
def with_clean_env
with_original_env do
- ENV['MANPATH'] = ENV['BUNDLE_ORIG_MANPATH']
- ENV.delete_if { |k,_| k[0,7] == 'BUNDLE_' }
- if ENV.has_key? 'RUBYOPT'
- ENV['RUBYOPT'] = ENV['RUBYOPT'].sub '-rbundler/setup', ''
- ENV['RUBYOPT'] = ENV['RUBYOPT'].sub "-I#{File.expand_path('..', __FILE__)}", ''
+ ENV["MANPATH"] = ENV["BUNDLE_ORIG_MANPATH"]
+ ENV.delete_if { |k,_| k[0,7] == "BUNDLE_" }
+
+ if ENV.has_key?("RUBYOPT")
+ ENV["RUBYOPT"] = ENV["RUBYOPT"].sub "-rbundler/setup", ""
+ end
+
+ if ENV.has_key?("RUBYLIB")
+ rubylib = ENV["RUBYLIB"].split(File::PATH_SEPARATOR)
+ rubylib.delete(File.expand_path("..", __FILE__))
+ ENV["RUBYLIB"] = rubylib.join(File::PATH_SEPARATOR)
end
+
yield
end
end