[Rubygems-developers] Two feature requests

Gavin Sinclair gsinclair at soyabean.com.au
Thu Sep 23 01:42:22 EDT 2004

Assaph wrote:
>> One of these, Chad knows about. The other is sorta new.
> Here's another request: Allow running a post-install script. This will
> alleviate the need to specify in the docs that the user must run the
> script to finish the install (e.g. the rubygems-update gem).
> Attached is a sample implementation (vs. todays cvs) and a test gemspec.
> Please feel free to accept/modify/ignore, but comments are always
> welcome :-)

I disapprove of post-install scripts.  They're convenient but they're a
leaky abstraction.  RubyGems is a terrific technology, but it shouldn't
take over your computer.  It shouldn't do anything that it doesn't know
how to undo -- that's one reason library stubs sucked and why handling of
application stubs needs slight improvement.

RubyGems is about managing Ruby packages.  Ruby packages shouldn't need a
post-install step.  rubygems-update and vim-ruby need these, but that's
because they're not actually Ruby packages; they're (ab)using the RubyGems
technology to achieve their own end.  That's justifiable and convenient,
but they should still stand out as exceptions.

What I might support is a post-install message that gets displayed to the
user.  That could be a "remember to run ..." or "you need external
dependency XYZ to use this gem" or "this gem runs better if you have XYZ

Another possibility is a non-installed application that's runnable from
the "gem" command.  Take vim-ruby for example.

  Scenario 1)
    gem install vim-ruby
    vim-ruby-install.rb       # which is in your bin directory

  Scenario 2)
    gem install vim-ruby
    gem run vim-ruby install.rb

(1) is the current state of things.  In scenario (2), the "install.rb"
doesn't actually get installed into your /usr/local/bin or whatever; it's
part of the gem and can only be run in that way.

Of course, both suggestions can co-exist:

  Scenario 3)
    gem install vim-ruby
       # -> "Please install via: gem run vim-ruby install.rb"
    gem run vim-ruby install.rb

Of course, here you're asking RubyGems to do something it can't undo.  But
you're _asking_ that, so you're responsible for knowing the consequences. 
And it's pretty clear that RubyGems is only facilitating it, it's not
actually doing it.


More information about the Rubygems-developers mailing list