From: Holden Glova Date: 2003-01-11T21:20:26+09:00 Subject: Re: 'require' search path -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sun, 12 Jan 2003 00:23, Tim Bates wrote: > I wish 'require' would count the current directory as the directory the > file is in, rather than the directory the script is being run from. My test > scripts do > > require 'test/tc_default' > > This works fine if you're running the test script which runs all the tests, > as it resides in the parent directory. However, if you cd into the test > directory and run a test case directly, it can't find it, since it's > looking for 'test/test/tc_default' instead, which of course doesn't exist. > > The same goes for my executable file, sitting in the bin directory. I've > had to add a line > > $: << __FILE__.sub(/\w*$/, '') + '../lib' > > in order to get it to run out of the tarball (I don't want to have to > install it while testing...) Then I added a pre-setup.rb (hook for > install.rb) which removes this line when the file is installed. This works, > but it is very kludgy to me - surely there's a better way? (Oh, and it > means once you run install.rb, the file is no longer the same one you > downloaded... this in itself is bad, I think.) > > Tim Bates Hi Tim, Maybe you can add to $: with ruby -I for those situations when you need to go into a directory to run a specific test as outlined above. - -- Signed, Holden Glova -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+IAw+0X8w8X71zPcRAoiXAJoCZykDpDNTmmCdSqxM1WbwuUycfwCdEe58 vG2v5ZJV9vuc47vSuxDRJu8= =Ago8 -----END PGP SIGNATURE-----