Skip to content

Commit 53114dd

Browse files
committed
Customize gem install and uninstall hooks
1 parent d6f9bd1 commit 53114dd

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

‎rubygems-plugin/rubygems_plugin.rb‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@ def install(options)
99
if defined?(Bundler::Installer)
1010
Bundler::Installer.prepend ReshimInstaller
1111
else
12-
maybe_reshim = lambda do |installer|
13-
# If any gems with executables were installed or uninstalled, reshim.
12+
Gem.post_install do |installer|
13+
# Reshim any (potentially) new executables.
14+
installer.spec.executables.each do |executable|
15+
`asdf reshim ruby #{RUBY_VERSION} bin/#{executable}`
16+
end
17+
end
18+
Gem.post_uninstall do |installer|
19+
# Unfortunately, reshimming just the removed executables or
20+
# ruby version doesn't work as of 2020/04/23.
1421
`asdf reshim ruby` if installer.spec.executables.any?
1522
end
16-
Gem.post_install &maybe_reshim
17-
Gem.post_uninstall &maybe_reshim
1823
end

0 commit comments

Comments
 (0)