diff options
Diffstat (limited to 'lib/bundler/shared_helpers.rb')
-rw-r--r-- | lib/bundler/shared_helpers.rb | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index d0c3f430aa..48038ac78b 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -74,22 +74,9 @@ module Bundler end def set_bundle_environment - # Set PATH - paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR) - paths.unshift "#{Bundler.bundle_path}/bin" - ENV["PATH"] = paths.uniq.join(File::PATH_SEPARATOR) - - # Set RUBYOPT - rubyopt = [ENV["RUBYOPT"]].compact - if rubyopt.empty? || rubyopt.first !~ %r{-rbundler/setup} - rubyopt.unshift %(-rbundler/setup) - ENV["RUBYOPT"] = rubyopt.join(" ") - end - - # Set RUBYLIB - rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR) - rubylib.unshift File.expand_path("../..", __FILE__) - ENV["RUBYLIB"] = rubylib.uniq.join(File::PATH_SEPARATOR) + set_path + set_rubyopt + set_rubylib end # Rescues permissions errors raised by file system operations @@ -167,6 +154,26 @@ module Bundler end end + def set_path + paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR) + paths.unshift "#{Bundler.bundle_path}/bin" + ENV["PATH"] = paths.uniq.join(File::PATH_SEPARATOR) + end + + def set_rubyopt + rubyopt = [ENV["RUBYOPT"]].compact + if rubyopt.empty? || rubyopt.first !~ %r{-rbundler/setup} + rubyopt.unshift %(-rbundler/setup) + ENV["RUBYOPT"] = rubyopt.join(" ") + end + end + + def set_rubylib + rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR) + rubylib.unshift File.expand_path("../..", __FILE__) + ENV["RUBYLIB"] = rubylib.uniq.join(File::PATH_SEPARATOR) + end + def clean_load_path # handle 1.9 where system gems are always on the load path if defined?(::Gem) |