Remove Gem.try_activate
usage
#1103
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is not meant to be merged as is, just opening it mainly as a question. I read the code and I could not understand the purpose of
Gem.try_activate
here.The only usage I know of
Gem.try_activate
is internal to RubyGems. It's part of its customrequire
implementation. When standardrequire
fails, RubyGems tries to activate a gem including the given path. That way it is added to the$LOAD_PATH
andrequire
can succeed when retried a second time.In this case, it seems to try to activate some potential gem including IRB localizations. However, that gem is never subsequently required so in particular I'm not sure what the
redo
is for, and not sure either if usingGem.try_activate
is necessary at all.Even if it was necessary, it should be probably guarded by
defined?(Bundler::Setup)
or something like that, because I don't thinkGem.try_activate
makes sense in abundler/setup
context, sincebundler/setup
eliminates RubyGems discovery mechanism and instead sets up a fixed$LOAD_PATH
with the gems in yourGemfile
. So, technically, if using some localization gem, you should add it to your Gemfile.For what it's worth, I found this while looking into this Bundler issue: rubygems/rubygems#8754.