From: Hassan Schroeder on
On Tue, Jul 27, 2010 at 3:10 PM, Joel VanderWerf
<joelvanderwerf(a)gmail.com> wrote:

> Maybe this will work?
>
>>> File.join *Config::CONFIG.values_at("bindir", "ruby_install_name")
> => "/usr/local/bin/ruby"

Works in a Rails console, but not a Ruby program. But thanks, now
that I consider it I should be able to work with that :-)

--
Hassan Schroeder ------------------------ hassan.schroeder(a)gmail.com
twitter: @hassan

From: Joel VanderWerf on
Hassan Schroeder wrote:
> On Tue, Jul 27, 2010 at 3:10 PM, Joel VanderWerf
> <joelvanderwerf(a)gmail.com> wrote:
>
>> Maybe this will work?
>>
>>>> File.join *Config::CONFIG.values_at("bindir", "ruby_install_name")
>> => "/usr/local/bin/ruby"
>
> Works in a Rails console, but not a Ruby program. But thanks, now
> that I consider it I should be able to work with that :-)

Hm, that's surprising. I tested it in ruby and jruby programs. What's
the problem?

$ ruby -v -rrbconfig -e 'p File.join(*Config::CONFIG.values_at("bindir",
"ruby_install_name"))'
ruby 1.8.7 (2010-06-23 patchlevel 299) [x86_64-linux]
"/usr/local/bin/ruby"

$ ruby19 -v -rrbconfig -e 'p
File.join(*Config::CONFIG.values_at("bindir", "ruby_install_name"))'
ruby 1.9.2dev (2010-07-02 revision 28524) [x86_64-linux]
"/usr/local/bin/ruby19"

$ jruby -v -rrbconfig -e 'p
File.join(*Config::CONFIG.values_at("bindir", "ruby_install_name"))'
jruby 1.5.0 (ruby 1.8.7 patchlevel 249) (2010-05-12 6769999) (Java
HotSpot(TM) 64-Bit Server VM 1.6.0_20) [amd64-java]
"/usr/local/jruby/bin/jruby"

From: Hassan Schroeder on
On Tue, Jul 27, 2010 at 3:52 PM, Joel VanderWerf
<joelvanderwerf(a)gmail.com> wrote:

>>>>> File.join *Config::CONFIG.values_at("bindir", "ruby_install_name")
>>>
>>> => "/usr/local/bin/ruby"
>>
>> Works in a Rails console, but not a Ruby program. But thanks, now
>> that I consider it I should be able to work with that  :-)
>
> Hm, that's surprising. I tested it in ruby and jruby programs. What's the
> problem?

ripple:~$ cat foo.rb
puts File.join *Config::CONFIG.values_at("bindir", "ruby_install_name")
ripple:~$ ruby foo.rb
foo.rb:1: uninitialized constant Config (NameError)
ripple:~$ jruby foo.rb
foo.rb:1: uninitialized constant Config (NameError)
ripple:~$

--
Hassan Schroeder ------------------------ hassan.schroeder(a)gmail.com
twitter: @hassan

From: Joel VanderWerf on
Hassan Schroeder wrote:
> On Tue, Jul 27, 2010 at 3:52 PM, Joel VanderWerf
> <joelvanderwerf(a)gmail.com> wrote:
>
>>>>>> File.join *Config::CONFIG.values_at("bindir", "ruby_install_name")
>>>> => "/usr/local/bin/ruby"
>>> Works in a Rails console, but not a Ruby program. But thanks, now
>>> that I consider it I should be able to work with that :-)
>> Hm, that's surprising. I tested it in ruby and jruby programs. What's the
>> problem?
>
> ripple:~$ cat foo.rb
> puts File.join *Config::CONFIG.values_at("bindir", "ruby_install_name")
> ripple:~$ ruby foo.rb
> foo.rb:1: uninitialized constant Config (NameError)
> ripple:~$ jruby foo.rb
> foo.rb:1: uninitialized constant Config (NameError)
> ripple:~$
>

You must require 'rbconfig':

$ ruby -v -rrbconfig -e 'p File.join(*Config::CONFIG.values_at("bindir",
"ruby_install_name"))'
ruby 1.8.7 (2010-06-23 patchlevel 299) [x86_64-linux]
"/usr/local/bin/ruby"


From: Hassan Schroeder on
On Tue, Jul 27, 2010 at 4:45 PM, Joel VanderWerf
<joelvanderwerf(a)gmail.com> wrote:

> You must require 'rbconfig':

Yes, I see that -- my first thought was that that's not going to be practical
in this case, but thanks, I'll play around with it.

--
Hassan Schroeder ------------------------ hassan.schroeder(a)gmail.com
twitter: @hassan