How to load rubygems_plugin.rb
when running bundle install
#1516
-
I'm reading the RBENV codebase, and I came upon its
According to the PR that introduced it, the goal of this code is to ensure that RBENV rebuilds its shims only at the end of the I wanted to step through the code to see how it works, so I did the following:
I was surprised to see that I didn't hit my debuggers. I also checked I also tried to install the version of Ruby which was active at the time of the original PR ( I read through the Bundler CHANGELOG.md file from the deprecated Bundler repo, to see if maybe support for this file was removed from the I'm guessing this is user error, and that I'm simply missing something. But I thought I'd post this question anyway, in case this file no longer loaded when Also FYI: I also read through the Bundler git history, and I saw this PR from June 2018 that introduced a |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Thanks for the detailed dive! I didn't know this, and you're right: in my testing it looks like You are also right that Bundler now has its own plugin API, but it doesn't look like rbenv can automatically inject its own plugin via environment variables. Instead, it looks like a user needs to explicitly enable a plugin via a I'd be fine with giving up on rbenv hooking into |
Beta Was this translation helpful? Give feedback.
-
If you're as curious as I was: Upon further research, it looks like this unexpected behavior was caused by this PR in the Bundler repo, specifically the removal of this line in
When I edit this file on my machine to add this line back and re-run This change was, in fact, mentioned in the Bundler CHANGELOG.md file, I simply glossed over it the first time around:
I found the Bundler released which introduced this behavior by installing every Bundler version from the last 8 years (not that many, really), and running I've already got a question open on the RubyGems repo here, and I'll add the above remarks to the question and see if they think it's worth a PR. |
Beta Was this translation helpful? Give feedback.
-
I was curious how one would go about hooking into Bundler to run TL;DR- running I'm having credential-related problems while trying to run Lastly, it turns out that there is no "AFTER_UNINSTALL_ALL" lifecycle hook in Bundler (presumably because there's no |
Beta Was this translation helpful? Give feedback.
Thanks for the detailed dive! I didn't know this, and you're right: in my testing it looks like
bundle
commands no longer cause therubygems_plugin.rb
file to be loaded from LOAD_PATH.You are also right that Bundler now has its own plugin API, but it doesn't look like rbenv can automatically inject its own plugin via environment variables. Instead, it looks like a user needs to explicitly enable a plugin via a
bundle
command.I'd be fine with giving up on rbenv hooking into
bundle install
, and instead just leaving thegem install
hook. People who use bundler can easily generate binstubs for their own project, which alleviates the need for rbenv to keep its shims up to date.