mirror of
https://github.com/pyenv/pyenv.git
synced 2024-12-23 01:21:22 +00:00
7e0e85bdda
As it seems, JRuby 1.7 complains on stderr every time you invoke `system`: warning: executable? does not in this environment and will return a dummy value It doesn't seem to complain when backtics are used. It's safe to use backticks here because `rbenv rehash` doesn't output anything on stdout, and the exit status of the command is irrelevant.
18 lines
472 B
Ruby
18 lines
472 B
Ruby
hook = lambda do |installer|
|
|
begin
|
|
# Ignore gems that aren't installed in locations that rbenv searches for binstubs
|
|
if installer.spec.executables.any? &&
|
|
[Gem.default_bindir, Gem.bindir(Gem.user_dir)].include?(installer.bin_dir)
|
|
`rbenv rehash`
|
|
end
|
|
rescue
|
|
warn "rbenv: error in gem-rehash (#{$!})"
|
|
end
|
|
end
|
|
|
|
begin
|
|
Gem.post_install(&hook)
|
|
Gem.post_uninstall(&hook)
|
|
rescue
|
|
warn "rbenv: error installing gem-rehash hooks (#{$!})"
|
|
end
|