Ted said:
Thanks. I created a post-install.rb and tested it but it doesn't get run
during the install as best I can tell. I've looked at the gem code and I
don't see code that would run my post-install.rb script maybe I just
missed it but ... Would you know where this happens? I did look at gems
already on my system but they only contain install.rb files.
I can only speak for RMagick, but fwiw,
install.rb was Minero Aoki's generic Ruby library/application installer
script, which predates RubyGems. I've since replaced it in the RMagick
install with Minero's setup.rb
(
http://i.loveruby.net/en/projects/setup/). (This is the same setup.rb
that you run to install RubyGems the first time.) The
install.rb/setup.rb scheme defines three steps during installation:
config, setup, and install. Each specific application/library can define
"hooks" that run before or after each step. A "hook" is a Ruby program.
The hook scripts are identified by their name, which is "pre-" or
"post-" followed by the step name. Thus "post-install.rb" is a hook that
runs after the install step. Therefore setup.rb runs the RMagick
post-install.rb hook after it completes the standard installation tasks.
In the RMagick case, post-install.rb copies the RMagick documentation
files to the doc directory. The install.rb/setup.rb process doesn't
define an uninstall step, so for RMagick, I provided a uninstall.rb
script that can be executed for the "make uninstall" target, or simply
by running "ruby uninstall.rb" from the command line.
Probably RMagick isn't a good model for an installation process. RMagick
was out there before there was a RubyGems, so I created an installation
process based on the at-the-time-standard install.rb/setup.rb code.
Later, at the request of an important but traditionally-minded supporter
I hacked a GNU configure/make/make install over that, and when RubyGems
came out I hacked it to work with RubyGems. I'm sure Rake and
activerecord are much better models.
The last time I checked RubyGems, for security purposes, did not support
the execution of arbitrary user-supplied scripts. Remember RubyGems may
be running with root/admin priviledges, so it wouldn't be wise to allow
just any ol' Ruby library developer to add code to the installation
process. To the best of my knowledge, if you can't specify it in a
gemfile you can't make RubyGems do it. If I'm wrong I'm sure somebody
will correct me.