From: ara.t.howard@... Date: 2006-02-17T00:48:27+09:00 Subject: Re: rubygems and Config::CONFIG On Thu, 16 Feb 2006, George Ogata wrote: > Hello, > > I have two versions of ruby installed, rooted at different source > trees. In order to make them not collide in my $PATH, I simply > configured one with a program-suffix: > > EPREFIX1/bin/ruby > EPREFIX2/bin/ruby18 > > Life was peachy until I installed rubygems. The gems executables all > go in the ruby bindirs (alongside ruby and ruby18), but they ignore > any --program-prefix or --program-suffix. Would it not be a good idea > to have the executables named with the same prefix and suffix as the > ruby executable? I think the shebang lines should also be rewritten > to use the full path to the ruby executable used to run setup.rb. > > Of course, this would make it impossible to move the ruby executable > without breaking gems, but I'd kinda expect a few things may break if > you were to pull a stunt like that. > > Now, there's no Config::CONFIG['program_suffix'] (or prefix), so it'd > probably be an idea to add these too. But they can also be sucked out > of Config::CONFIG['configure_args'] with Shellwords easily. > > What do you think? 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) #!/usr/bin/env ruby require 'rubygems' Gem.manage_gems required_version = Gem::Version::Requirement.new(">= 1.8.0") unless required_version.satisfied_by?(Gem::Version.new(RUBY_VERSION)) puts "Expected Ruby Version #{required_version}, was #{RUBY_VERSION}" exit(1) end # We need to preserve the original ARGV to use for passing gem options # to source gems. If there is a -- in the line, strip all options after # it...its for the source building process. args = !ARGV.include?("--") ? ARGV.clone : ARGV[0...ARGV.index("--")] # allow env vars of GEM_xxx or command lines args of k=v to supercede any # Config::CONFIG values kvs = [] # # this allows commands like # # GEM_bindir=/usr/local/bin gem install arrayfields # # or # # gem install arrayfields bindir=/usr/local/bin # # note that any and all Config::CONFIG values may be tweaked for fine # grained control of install process. # re = %r/^ \s* ([^=\s]+) \s* = \s* ([^\s]+) \s* $/x args.delete_if{|arg| (m = re.match(arg)) and (kvs << m.to_a.last(2))} ENV::each{|k,v| (k =~ %r/^GEM_/) and (kvs << [k.delete('GEM_'), v])} unless kvs.empty? require 'rbconfig' kvs.each{|k,v| Config::CONFIG[k] = v} end Gem::GemRunner.new.run(args) please try this out and let me know how it works for you. kind regards. -a -- judge your success by what you had to give up in order to get it. - h.h. the 14th dali lama