rubygems_plugin.rb 662 字节
Newer Older
1 2 3 4 5
module ReshimInstaller
  def install(options)
    super
    # We don't know which gems were installed, so always reshim.
    `asdf reshim ruby`
A
Akash Manohar J 已提交
6
  end
7
end
A
Akash Manohar J 已提交
8

9 10 11
if defined?(Bundler::Installer)
  Bundler::Installer.prepend ReshimInstaller
else
12 13 14 15 16 17 18 19 20
  Gem.post_install do |installer|
    # Reshim any (potentially) new executables.
    installer.spec.executables.each do |executable|
      `asdf reshim ruby #{RUBY_VERSION} bin/#{executable}`
    end
  end
  Gem.post_uninstall do |installer|
    # Unfortunately, reshimming just the removed executables or
    # ruby version doesn't work as of 2020/04/23.
21 22
    `asdf reshim ruby` if installer.spec.executables.any?
  end
A
Akash Manohar J 已提交
23
end