[email protected] writes:
i have exactly the same issue here at work and i’m working with chad
and jim to get something like this into rubygems now:
(gem script)
[…]
please try this out and let me know how it works for you.
Hi Ara,
I think that might be addressing a different issue. That lets you
give `gem’ a bindir, etc. through envvars, so it can, e.g., install
each gem in a different location, right?
What I was proposing was that the `gem’ script itself should respect
the program prefix and suffix. For example, if I have two ruby
builds:
–prefix=/usr/local/ruby | --prefix=/usr/local/ruby18
| --program-suffix=18
-----------------------------±-----------------------------
/usr/local/ruby/bin/rdoc | /usr/local/ruby18/bin/rdoc18
/usr/local/ruby/bin/ri | /usr/local/ruby18/bin/ri18
/usr/local/ruby/bin/ruby | /usr/local/ruby18/bin/ruby18
/usr/local/ruby/bin/… | /usr/local/ruby18/bin/…
then:
cd rubygems-0.8.11 | cd rubygems-0.8.11
ruby setup.rb | ruby18 setup.rb
installs: | installs:
/usr/local/ruby/bin/gem | /usr/local/ruby18/bin/gem18
with shebang path: | with shebang path:
/usr/local/ruby/bin/ruby | /usr/local/ruby18/bin/ruby18
Should be easy to do; all the info needed is in Config::CONFIG.
gem18 install blah' would install gems in the
ruby18’ tree, and gem install blah' would install gems for in the
ruby’ tree. Complete
separation.
I don’t yet know whether exectuables installed by gems have suffixes
etc., but I think they should too: rake' should use
ruby’, rake18' should use
ruby18’. The rule of thumb would be that anything in the
ruby bin directory must have the program-prefix and program-suffix of
the ruby binary used to install it, and if it’s a ruby script, it must
use the complete path to that same ruby binary in its shebang. Note
that everything in the ruby bin dir from standard ruby already follows
this pattern. If rubygems was to become part of standard ruby, surely
it would follow suit.
I’m not sure what your scenario is, Ara, but might this be an
alternative to using environment variables?
The scenario that led me to this was having two rubies installed in
different directories. Since the name and content of the gem file is
fixed, installing rubygems with each ruby gave me:
/usr/local/ruby/bin/gem – with shebang line #!/usr/bin/env ruby
/usr/local/ruby18/bin/gem – with shebang line #!/usr/bin/env ruby
Not only does which gem
depend on the PATH, but they both use
/usr/local/ruby/bin/ruby anyway. D’oh!
I imagine another fairly common scenario is to have more than one
build on a shared drive on a heterogenous network. e.g., a network of
Solaris and Linux hosts might have ruby mounted on a shared drive with
binaries ruby.i386 and ruby.sun5 in the same directory. In this case,
I think you’d similarly need a gem.i386' that uses
ruby.i386’, and a
gem.sun5' that uses
ruby.sun5’ (in the shebang). This would also
allow each gem to configure itself for the current platform if
necessary using Config::CONFIG.