[Rubygems-developers] --format-executable should be the default

Christian Holtje docwhat at gmail.com
Tue Jul 7 14:38:57 EDT 2009


Hello!

I'm really enjoying ruby; the gem framework is absolutely amazing.

When I was trying to use multiple versions of Ruby on the same system,  
I ran across this one confusing aspect: the executables for gems  
didn't have the same naming convention as the "ruby" and "irb"  
executables.

So I filed bug 1728[1] and Eric Hodel was kind enough to point me to  
this mailing list.

It seems that "gem --format-executable" should default to "true"  
because the binaries created  have the name of the "ruby" executable  
embedded in them (in the #! at the top).
Here are two use cases to help illustrate:
----use case 1-----------------------
I install ruby 1.8.

I use "./configure" when compiling it.
The binaries are in /usr/bin/ and do not have a suffix.

I decide I want to work on ruby 1.9.1 as well.
I use "./configure --program-suffix=19" when compiling it.
The binaries are also in /usr/bin but all end with "19", such as "/usr/ 
bin/ruby19".

Lets say I ZenTest for 1.8:
$ gem install ZenTest

This creates /usr/bin/autotest. This executable is intimately tied to  
ruby 1.8; it begins with "#!/usr/bin/ruby -ws" -- it cannot be used  
for ruby 1.9 (yet) because the libraries are not installed in ruby 1.9  
and the executable it points to is the 1.8 executable.

Now lets say I want to install autotest for ruby 1.9:
$ gem19 install ZenTest

By default, no new binaries are created since they already exists.

The executable /usr/bin/autotest is *still* tied to ruby 1.8.

This causes confusion by the user; they just installed autotest for  
ruby 1.9 but it still is running ruby 1.8.
-----------------------------------

----use case 2-----------------------
My system administrator installs ruby 1.8 using "./configure" with no  
arguments.
My system administrator installs ruby 1.9.1 using "./configure -- 
program-suffix=19"

I (a non-system-administrator) wants to install ZenTest for both:
$ gem install ZenTest
[output showing it is installed to ~/.gem]
$ gem19 install ZenTest
[output showing it is installed to ~/.gem]

So now I have two "autotest" binaries:
~/.gem/ruby/1.8/bin/autotest
and
~/.gem/ruby/1.9.1/bin/autotest

If my PATH includes both, then which "autotest" I get depends on my  
PATH order.  The only way I can distinguish between the two  
executables is by changing my PATH on the fly.  Not very useful if I  
want to be able to easily switch between both versions to verify it  
works in both versions of Ruby.
-----------------------------------

As you can see it can be rather confusing for "--format-executable"  
not to be the default.

It was doubly confusing for me because everything else worked so  
well. :-)

Ciao!

[1] http://redmine.ruby-lang.org/issues/show/1728


More information about the Rubygems-developers mailing list