[Rubygems-developers] Thoughts on handling bin and man files
Gavin Sinclair
gsinclair at soyabean.com.au
Thu Mar 18 13:42:32 EST 2004
One open issue with RubyGems is handling applications and not just
libraries. Libraries are "easy" in the RG model because RG mangles
Ruby's $LOAD_PATH. That's not so easy with applications.
There are two options as I see it. Let's take the case of an
application "date.rb" that tells you the date. It's packaged into
"date.gem" and we want to install it. Here are the scenarios.
1. Use symbolic links.
Installing "date.gem" plants the following symbolic link:
/usr/local/bin/date.rb -> $GEMDIR/date-0.1/bin/date.rb
Uninstalling "date.gem" sweeps /usr/local/bin, looking for symbolic
links to anything under $GEMDIR/date-0.1/bin and removing them.
Note that in this case, date.rb must still use 'require_gem' to
resolve any date-related libraries. This, I suggest, is bad.
2. Mangle $PATH, which requires a 'gem' frontend.
Installing "date.gem" requires no special tricks for bin files.
However, in order to run it, you must do this:
gem --run date
This:
- looks for a locally-installed gem called 'date'
- determines its default executable (another piece of metadata),
which is "date.rb"
- runs "date.rb"
- "date.rb" must transparently be able to find date-related
libraries, so 'require_gem "date"' must somehow find its way in
there
Both solutions have problems, and I can't think of any others at the
moment.
Whatever works for executables can also work for man pages.
Cheers,
Gavin
More information about the Rubygems-developers
mailing list