On 7/22/05, James Edward Gray II <james / grayproductions.net> wrote:
> On Jul 22, 2005, at 7:48 AM, Brian Candler wrote:
> 
> > Note 3: if you want to run the programs in bin/ without first
> > installing
> > their libraries you can do so, but you'll need to update the
> > $LOAD_PATH
> > appropriately. This can be done by hand:
> >
> >   cd bin
> >   ruby -I../lib my_program.rb
> >
> > or in the outer directory:
> >
> >   ruby -Ilib bin/my_program.rb
> 
> It's often desirable to add both directories to the path, especially
> with testing (Test Suites load Test Cases probably in the same
> directory).  The -I option can handle this too:
> 
> ruby -I lib:test test/ts_all.rb
> 
> > If anybody has a simpler solution than this, I'd be interested to
> > see it.
> 
> I used to muck with $: as you showed, then I discovered the wonderful
> world of Rake.  Most of the tasks will just do the right thing.  For
> example, here's the equivalent of my test example above:
> 
> require "rake/testtask"
> 
> task :default => [:test]
> 
> Rake::TestTask.new do |test|
>      test.libs << "test"    # "lib" is already in there
>      test.test_files = [ "test/ts_all.rb" ]
>      test.verbose = true
> end
> 
> I guess that looks a little verbose, but with the above running my
> tests is as simple as:
> 
> $ rake
> 
> And Rake is handy for SO much more.  I've gotten into the habit of
> making a task for everything.  I have tasks that generated a
> project's documentation with RDoc, then move it up to Rubyforge for me.
> 
> It took me maybe 30 minutes to get comfortable with Rake and I
> haven't mucked with $: since.  (When I'm building my own tasks I use -
> I all:the:directories:i:need, as shown above.) I think it was time
> well spent.

I've recenlty poked my nose into Rake, and it looked like it could be
very handy, but I've yet to find the right docs/tutorial to get me to
the point where I "get" it.  Could be that I'm trying to use it with
another language, dunno.

Thought it might also be handy to develop libraries in a lib dir
that's under a project dir, then use Rake to install them under
site_ruby so they'd be available for other projects.  Cuts down on
file system nav while I'm building it, and I'd end up with an install
file to hand out to others.

anyway, if anybody knows of tutorials/examples that aren't so
c-oriented, I'd love to see them.
 
> Hope that helps.
> 
> James Edward Gray II
> 

-- 
Bill Guindon (aka aGorilla)