Austin Ziegler wrote:
>>
>> I need to set it up so that the applications executing the require
>> actually find the objects of the require statement
>
> This may be changed in Ruby 1.8.5, I think, but the answer essentially
> is yes.
>
> You can use RUBYOPTS=-rubygems but that's a bit of a hack.
Thanks. Setting RUBYOPTS would not be a hack if it worked. In my case ir
would be /usr/local/lib/ruby/site_ruby/but that is precicely where the
GEMS do not get installed by gem install ...
What the RUBYOPT environment variable provides is a default set of
flags to provide to the ruby runtime. So these are essentially
equivalent:
RUBYOPT=-rubygems ruby foo.rb
ruby -rubygems foo.rb
An added bonus to using RUBYOPT is that scripts marked as executable
and with a shebang will receive the benefit as well. So if you're
script starts with #!/usr/bin/ruby, then setting RUBYOPT=-rubygems
before running the script is the same as changing the shebang to
include the -rubygems flag.
Now, the -rubygems flag itself isn't really it's own flag, it's a
clever use of Ruby's -r flag. The -r flag requires its argument at the
start of the script, as if you had added a require statement. So using
the -rubygems flag (or placing -rubygems in your RUBYOPT) is
equivalent to adding the following line to the top of every script:
require 'ubygems'
The ubygems.rb file (in /usr/lib/ruby/site_ruby/1.8/ on my system) in
turn simply loads the actual 'rubygems' library. The 'ubygems' version
is there just so you can type a -rubygems flag rather than -rrubygems.
So... setting RUBYOPT=-rubygems is essentially equivalent to adding
require 'rubygems' to each of your scripts, all through one
environment variable.
Thank you for your help. I am not about to grep through all files
prepending a missing line of code, that is no fun :-). I'll wait for a
while to see if this is fixed and play with Ruby on my Mac where it
works perfectly - same version, same gems and same typi application.
My guess is that it works on your Mac but not on your other machine
because the Mac already has the RUBYOPT environment variable set up,
while your other machine doesn't. You can check with:
echo $RUBYOPT
on both machines at the command line. You can also try:
RUBYOPT=-rubygems script/server
in your typo directory.
Jacob Fugal
···
On 6/29/06, Lanny Rosicky <lanny@canczech.com> wrote:
> On 6/29/06, Lanny Rosicky <lanny@canczech.com> wrote: