[Rubygems-developers] Thoughts on handling bin and man files

Chad Fowler chad at chadfowler.com
Fri Mar 19 11:22:00 EST 2004


On Thu, 18 Mar 2004, Jim Weirich wrote:

# Chad Fowler wrote:
# > application.  To me, gem --run can fill that need, though the files will 
# > end up being extracted.  As long as it's transparent, it shouldn't 
# > matter.  You could even do:
# > 
# > gem --run mygem-0.1.1.gem
# > 
# > ...and it could extract the gem to a personal directory if it's not 
# > already installed (either globally or locally) and run transparently.  
# > That's kind of appealing.
# 
# I'm not wild about this option.  I'm sure people will not want to type
# 
#     gem --run rake-0.3.1
# 
# every time they want to run rake.  Perhaps this can be an option for 
# stuff you use only occasionally, but we need a way of installing 
# directly into the user's PATH.
# 
# Here's an option I hadn't seen yet.  Create a bin directory in the gem 
# installation area.  All the user would need to do is add this directory 
# to his search path.  Since all gem applications would go into this 
# directory, it would not too onerous on the user.
# 
# Perhaps a better idea would be provide an install-app option to gem and 
# specify the bin directory directly.  E.g.
# 
#      gem --install-app  --exec-prefix=/usr/local/bin rake-0.3.1
# 
# The default directory could be wherever the ruby command was installed. 
#   Allowing --exec-prefix means a user could install apps into his home 
# directory.  One problem is that this would only support a single version 
# at a time, even though multiple gems of the library could be install.
# 
# Symbolic links aren't a bad idea (on Unix ... not on Windows, alas). 
# Has anyone looked at how "stow" manages its links.  Perhaps we need a 
# ruby version of stow.  (see http://www.gnu.org/software/stow/stow.html)
# 
# 

How about combining installation of executables into exec-prefix (or the 
default of where ruby was installed) and the gem --run option?  The 
installation procedure could just write over (optionally) whatever 
executables you have in, for example, /usr/local/bin, and we could *also* 
install install them in a gem-specific "bin" directory.  This would mean 
that for Rake, you would be able to do this:

$ rake  # runs rake out of a directory that's normally in the path
$ gem --run rake --version 0.3.0   # runs a specific version of the rake 
executable from its gem directory

This gives us the best of both worlds without having to mess around with 
symbolic links.  You get to run the commands conveniently for the most 
recent version installed (we could figure out that logic--would it be the 
highest version that wins?) but you also get to maintain different 
versions of the commands and libraries and run them if you need to.

I think this approach makes things easy for the 99% case of not needing to 
run specific versions of the gem but makes it *possible* to do the 
back-rev 1% case.  The disadvantage is that you have two copies of the 
executable, but I could live with that quite happily.

What do you think?

Chad



More information about the Rubygems-developers mailing list