1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-16 15:23:53 -05:00

Support GEM_HOME, add limited support for user-installed gems (#1436)

The rehash process will now discover executables in additional locations:
- `~/.gem/ruby/<version>/bin/*`
- `$GEM_HOME/bin`

The `rbenv which` (and thus `rbenv exec`) command will also search these locations when looking up a command. This enables shims to dispatch calls to executables added by `gem install --user-install`.

Note that this support is limited:
- It will only work with C Ruby, as it's difficult to guess the `~/.gem/<engine>/<version>` directory for other Rubies without actually loading Ruby;
- It will only work for RBENV_VERSION values in the format `X.Y.Z` and not "system".
This commit is contained in:
Mislav Marohnić
2022-09-26 02:57:15 +02:00
committed by GitHub
parent 009ef3a2db
commit 959968c46d
5 changed files with 86 additions and 5 deletions

View File

@@ -37,6 +37,15 @@ else
begin
Gem.post_install(&hook)
Gem.post_uninstall(&hook)
# Silence the warning that would be printed for --user-install'ed gems:
#
# WARNING: You don't have ~/.gem/ruby/<version>/bin in your PATH,
# gem executables will not run.
#
# This warning isn't accurate in the context of rbenv because the executables
# at this location will automatically be available for running through rbenv.
Gem::Installer.path_warning = true if Gem::Installer.respond_to?(:path_warning=)
rescue
warn "rbenv: error installing gem-rehash hooks (#{$!.class.name}: #{$!.message})"
end