lib/vagrant/util/env.rb in vagrant-unbundled-1.8.5.2 vs lib/vagrant/util/env.rb in vagrant-unbundled-1.9.1.1

- old
+ new

@@ -1,13 +1,13 @@ -require "bundler" - module Vagrant module Util class Env def self.with_original_env original_env = ENV.to_hash - ENV.replace(::Bundler::ORIGINAL_ENV) if defined?(::Bundler::ORIGINAL_ENV) + if defined?(::Bundler) && defined?(::Bundler::ORIGINAL_ENV) + ENV.replace(::Bundler::ORIGINAL_ENV) + end ENV.update(Vagrant.original_env) yield ensure ENV.replace(original_env.to_hash) end @@ -35,10 +35,12 @@ # # @param [Proc] block # the block to execute with the cleaned environment def self.with_clean_env with_original_env do - ENV["MANPATH"] = ENV["BUNDLE_ORIG_MANPATH"] + if ENV["BUNDLE_ORIG_MANPATH"] + ENV["MANPATH"] = ENV["BUNDLE_ORIG_MANPATH"] + end 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__)}", "") end