summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2018-07-09 20:38:19 -0700
committerAndre Arko <andre@arko.net>2018-07-09 20:38:19 -0700
commite97d0d70bc22f889927c0df4edbbb9ef541575ba (patch)
tree34fca4ed7e3bcbb85dc6820096a0c3039e1bea28
parent1afd8df50f551835f0fba3285a9b4e6da36b4a6c (diff)
downloadbundler-e97d0d70bc22f889927c0df4edbbb9ef541575ba.tar.gz
recursively follow symlinks
-rw-r--r--lib/bundler/shared_helpers.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index 1ae10afd07..05928fc4d0 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -336,16 +336,18 @@ module Bundler
loaded_gem_paths = Bundler.rubygems.loaded_gem_paths
$LOAD_PATH.reject! do |p|
- expanded_p = File.expand_path(p)
- next if expanded_p.start_with?(bundler_lib)
- if File.exist?(expanded_p) && File.respond_to?(:realpath)
- next if File.realpath(expanded_p).start_with?(bundler_lib)
- end
+ next if resolve_path(p).start_with?(bundler_lib)
loaded_gem_paths.delete(p)
end
$LOAD_PATH.uniq!
end
+ def resolve_path(path)
+ expanded = File.expand_path(path)
+ expanded = File.realpath(expanded) until expanded == File.realpath(expanded)
+ expanded
+ end
+
def prints_major_deprecations?
require "bundler"
deprecation_release = Bundler::VERSION.split(".").drop(1).include?("99")