mirror of
https://github.com/rbenv/rbenv.git
synced 2024-12-28 20:55:38 +01:00
Move gem-rehash monkey patch (#1541)
The `rubygems_plugin.rb` file doesn't get loaded until after `Bundler::Installer.install` is called, so target `Bundler::Installer#install` to fix invocation order issues. Co-authored-by: Mislav Marohnić <git@mislav.net>
This commit is contained in:
parent
d10388a052
commit
325abac17d
1 changed files with 19 additions and 17 deletions
|
@ -10,11 +10,14 @@ hook = lambda do |installer|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if defined?(Bundler::Installer) && Bundler::Installer.respond_to?(:install) && !Bundler::Installer.respond_to?(:install_without_rbenv_rehash)
|
if defined?(Bundler::Installer) &&
|
||||||
|
Bundler::Installer.private_method_defined?(:install) &&
|
||||||
|
!Bundler::Installer.private_method_defined?(:install_without_rbenv_rehash)
|
||||||
Bundler::Installer.class_eval do
|
Bundler::Installer.class_eval do
|
||||||
class << self
|
private
|
||||||
|
|
||||||
alias install_without_rbenv_rehash install
|
alias install_without_rbenv_rehash install
|
||||||
def install(root, definition, options = {})
|
def install(options)
|
||||||
begin
|
begin
|
||||||
if Gem.default_path.include?(Bundler.bundle_path.to_s)
|
if Gem.default_path.include?(Bundler.bundle_path.to_s)
|
||||||
bin_dir = Gem.bindir(Bundler.bundle_path.to_s)
|
bin_dir = Gem.bindir(Bundler.bundle_path.to_s)
|
||||||
|
@ -24,7 +27,7 @@ if defined?(Bundler::Installer) && Bundler::Installer.respond_to?(:install) && !
|
||||||
warn "rbenv: error in Bundler post-install hook (#{$!.class.name}: #{$!.message})"
|
warn "rbenv: error in Bundler post-install hook (#{$!.class.name}: #{$!.message})"
|
||||||
end
|
end
|
||||||
|
|
||||||
result = install_without_rbenv_rehash(root, definition, options)
|
result = install_without_rbenv_rehash(options)
|
||||||
|
|
||||||
if bin_dir && File.exist?(bin_dir) && Dir.entries(bin_dir).size > bins_before
|
if bin_dir && File.exist?(bin_dir) && Dir.entries(bin_dir).size > bins_before
|
||||||
`rbenv rehash`
|
`rbenv rehash`
|
||||||
|
@ -32,7 +35,6 @@ if defined?(Bundler::Installer) && Bundler::Installer.respond_to?(:install) && !
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Gem.post_install(&hook)
|
Gem.post_install(&hook)
|
||||||
|
|
Loading…
Reference in a new issue