K
Ken Innes
I inherited a project that uses Ruby 1.4.6 on a RedHat Linux 6.1J. I
copied it onto my RedHat Linux 6.1J machine, but there is a problem
when I try to build it; the ruby scripts are unable to find required
files (located in the same directory as the scripts) when the script
is executed from a different directory. I upgraded to Ruby 1.6.7,
which fixed that problem, but the scripts are not quite compatible
with the updated Ruby, so I had to revert to the version that was
originally used.
As an example, lets say I have two ruby scripts in a directory:
/scripts/script1.rb:
#!/usr/bin/ruby
require "script2"
/scripts/script2.rb:
print "Testing...\n"
Command Prompt:
[testing]# cd /scripts
[scripts]# script1.rb
Testing...
[scripts]# cd /testing
[testing]# script1.rb
script1.rb:2:in `require': No such file to load -- script2
(LoadError)
With Ruby 1.6.7, it works fine. With Ruby 1.4.6, it can find
script1.rb, but not script2.rb.
There must be a way to correct this, as the project apparently worked
for the original developers. I'm using the same OS, and I added the
same ruby options and script directory to my path as specified in
their readme (well almost, they said put it in .cshrc, but I had to
put it in .tcshrc for it to work):
setenv RUBYOPT '-Ke -rkconv'
set path = ( $path /scripts)
I also tried the following:
setenv RUBYOPT '-Ke -rkconv -S'
setenv LOAD_PATH /scripts
setenv RUBYLIB /scripts
So what am I missing here? Does anyone know how I can get this to work
correctly WITHOUT ALTERING THE SCRIPTS (because there are hundreds of
scripts)?
copied it onto my RedHat Linux 6.1J machine, but there is a problem
when I try to build it; the ruby scripts are unable to find required
files (located in the same directory as the scripts) when the script
is executed from a different directory. I upgraded to Ruby 1.6.7,
which fixed that problem, but the scripts are not quite compatible
with the updated Ruby, so I had to revert to the version that was
originally used.
As an example, lets say I have two ruby scripts in a directory:
/scripts/script1.rb:
#!/usr/bin/ruby
require "script2"
/scripts/script2.rb:
print "Testing...\n"
Command Prompt:
[testing]# cd /scripts
[scripts]# script1.rb
Testing...
[scripts]# cd /testing
[testing]# script1.rb
script1.rb:2:in `require': No such file to load -- script2
(LoadError)
With Ruby 1.6.7, it works fine. With Ruby 1.4.6, it can find
script1.rb, but not script2.rb.
There must be a way to correct this, as the project apparently worked
for the original developers. I'm using the same OS, and I added the
same ruby options and script directory to my path as specified in
their readme (well almost, they said put it in .cshrc, but I had to
put it in .tcshrc for it to work):
setenv RUBYOPT '-Ke -rkconv'
set path = ( $path /scripts)
I also tried the following:
setenv RUBYOPT '-Ke -rkconv -S'
setenv LOAD_PATH /scripts
setenv RUBYLIB /scripts
So what am I missing here? Does anyone know how I can get this to work
correctly WITHOUT ALTERING THE SCRIPTS (because there are hundreds of
scripts)?