diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2021-11-29 18:18:24 +0100 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-12-07 01:53:39 +0900 |
commit | 526c9359cae8226608a566f414f04b2c6a204d81 (patch) | |
tree | 9e978127f69bee8f72ed53569d5d13d7fa0192b4 /lib | |
parent | 715a51a0d6963f9d727191d4e1ad0690fd28c4dd (diff) | |
download | ruby-526c9359cae8226608a566f414f04b2c6a204d81.tar.gz |
[rubygems/rubygems] Don't cleanup paths from gems already activated from `$LOAD_PATH`
This way, if some default gem has been required before bundler, and
rubygems has enhanced the `$LOAD_PATH` to use the latest version in the
system, further requires of that default gem after bundler has been
activated will use the same version and don't cause redefinition
warnings or worse problems derived from the fact of mixing up two
different versions. That, unless the gem is a `Gemfile` dependency. In
that case, we'll get a mismatch error anyways as we do now.
This fix doesn't mean that all default gems internally used by
bundler/rubygems are now supported inside `Gemfile`'s. That should be
handled case by case, but it will now bite people only when they try to
add the gem to their `Gemfile`, not before.
https://github.com/rubygems/rubygems/commit/7325530547
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/shared_helpers.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 405ade95dd..846b9cc3aa 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -313,12 +313,11 @@ module Bundler end def clean_load_path - bundler_lib = bundler_ruby_lib - loaded_gem_paths = Bundler.rubygems.loaded_gem_paths $LOAD_PATH.reject! do |p| - next if resolve_path(p).start_with?(bundler_lib) + resolved_path = resolve_path(p) + next if $LOADED_FEATURES.any? {|lf| lf.start_with?(resolved_path) } loaded_gem_paths.delete(p) end $LOAD_PATH.uniq! |