post-install hook for a particular gem

Posted by Henry Flower on Stack Overflow See other posts from Stack Overflow or by Henry Flower
Published on 2010-12-31T17:30:22Z Indexed on 2011/01/01 4:54 UTC
Read the original article Hit count: 214

Filed under:
|
|

Here is what I've googled:

http://www.mail-archive.com/[email protected]/msg02168.html

Gem.post_install do |installer|
  puts "!!! #{installer.spec.full_name} INSTALLED !!!"
end

But where to put this snipped? If I put it in my Rakefile and/or src_of_myproject/lib/rubygems_plugin.rb file, than build the gem, install it--but the expected string is never printed after the installation.

I'm totally confused. How to embed the post-install hook into the gem spec?

Update: it's getting more interesting. If I put Gem.post_uninstall hook in src_of_myproject/lib/rubygems_plugin.rb--that hook works.

Gem.post_uninstall do |uninstaller|
  puts "!!! #{uninstaller.spec.full_name} UNINSTALLED !!!"
end

Hm... And wtf is with Gem.post_install?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about rake