From: Eric Hodel Date: 2007-01-05T10:51:35+09:00 Subject: Re: Managing "requires" in projects with many subdirectories On Jan 4, 2007, at 17:10, jeffz_2002@yahoo.com wrote: > Thanks for the notes ... one final question: > >> Now I'm slowly going back to requires with relative paths to 'lib' >> directory, that gets on the search path from the main file or command >> line. > > Does this mean that your files would, say, look like this: > > (file a.rb) > require 'some/thing' > > and then the command line becomes: > > $ ruby -Ipath/to/lib my_file.rb ? At worst I use ruby -Ilib my_file. Rarely is it way over there in path/to. (When it is, I set up a rake rule.) > The reason I ask is that you still need to pull in the path/to/lib > somewhere, and including it in the -I param means that subsequent devs > will need to know this (yes, I know it's minor, but I'd want others to > be able to cd to /tests and just write "ruby ts_all.rb", or "ruby > tc_specific_test_case.rb" in any subdirectory ... trying to make life > easy for them, cause I'm such a great guy). Nobody needs to remember anything if you write it down in a rake rule. Automate, automate, automate. PS: the Test::Unit convention is tests live in test/ and implementations live in lib/ and test files start with test_. This makes working with the standard tools (like testrb) and interoperating with other tools (like rake and ZenTest) a breeze. > Also, minor point, but path separators are different in different OSs, > aren't they? Ruby is smart enough to do what you mean. -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net I LIT YOUR GEM ON FIRE!