--3VRmKSg17yJg2MZg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Ken Innes (primehalo / hotmail.com) wrote: > 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. While I believe you, I don't see how ruby can see from /testing into /scripts. > 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 ^^^^^^^^^^^^^^^^^^^^^^^ This should do the trick. You can verify this with something like: cd /testing ruby14 -e 'p $:' -r /scripts/script1.rb /scripts should be the first thing in the array. > 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)? PS: I now have a ruby14 installed! -- Eric Hodel - drbrain / segment7.net - http://segment7.net All messages signed with fingerprint: FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --3VRmKSg17yJg2MZg Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQFBixrJMypVHHlsnwQRAvL+AJ9l/z9hsRIMOh04eIGkZSylhq6KiACg3mFS YEB1XD+Gd/fit/GlMA3mwlw GF -----END PGP SIGNATURE----- --3VRmKSg17yJg2MZg--