Remove Gem.try_activate usage - #1103
Closed
deivid-rodriguez wants to merge 1 commit into
Closed
Conversation
deivid-rodriguez
force-pushed
the
remove-gem-try-activate-usage
branch
from
June 16, 2025 10:18
e1d3644 to
b5952ab
Compare
Author
|
Something I've also noticed is that the only internal usage of |
Author
|
I merged a workaround in Bundler, so the warnings triggered by this |
Author
|
There's actually a second issue reported to us due to this, we may choose to also workaround that on our side, but just letting you know. It's ruby/rubygems#7545. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_activatehere.The only usage I know of
Gem.try_activateis internal to RubyGems. It's part of its customrequireimplementation. When standardrequirefails, RubyGems tries to activate a gem including the given path. That way it is added to the$LOAD_PATHandrequirecan 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
redois for, and not sure either if usingGem.try_activateis 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_activatemakes sense in abundler/setupcontext, sincebundler/setupeliminates RubyGems discovery mechanism and instead sets up a fixed$LOAD_PATHwith 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: ruby/rubygems#8754.