Ruby Gems, pre_install and post_install hooks

Re: pre_install and post_install hooks

I am trying to figure out how these two methods are properly employed.
The documentation for Ruby Gems says this:

RubyGems Defaults, Packaging

RubyGems defaults are stored in rubygems/defaults.rb. If you’re
packaging RubyGems or implementing Ruby you can change RubyGems’
defaults.

For RubyGems packagers, provide
lib/rubygems/defaults/operating_system.rb and override any defaults from
lib/rubygems/defaults.rb.

For Ruby implementers, provide lib/rubygems/defaults/#{RUBY_ENGINE}.rb
and override any defaults from lib/rubygems/defaults.rb.

If you need RubyGems to perform extra work on install or uninstall, your
defaults override file can set pre and post install and uninstall hooks.
See ::pre_install, ::pre_uninstall, ::post_install, ::post_uninstall.

To me this implies that these two methods are for use when installing
Ruby Gems itself and do not apply to subsequent gem installs. Is this
impression correct?

However, the use case I have requires a post_install hook for the gem I
am building. Are these methods available for use by individual gems? If
so how does one employ them? Can one create
lib/rubygems/defaults/operating_system.rb under the gem root and have
that used when installing a specific gem? If not then how does one get
the functionality of a post_install hook for installing a specific gem?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs