From: James Edward Gray II Date: 2005-07-22T22:40:15+09:00 Subject: Re: Are there packages? 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. Hope that helps. James Edward Gray II