From: Brian Candler Date: 2007-03-10T23:48:57+09:00 Subject: Re: Code organisation "template" interference(?) with RUBYLIB envar On Sat, Mar 10, 2007 at 08:25:09AM +0900, Paul van Delst wrote: > ---project1 (module Proj1) > | |--lib > | | |---project1.rb (class Proj1::Runner) > | | |---config > | | | | > | | | `--config.rb (class Proj1::Config) ... > require 'base/base' > module Proj2 > module Runner1 I'd suggest putting a single entry in your load path, for the very top level of your directory structure, and then use require 'project1/lib/base/base' instead of require 'base/base' This is the simplest way of easily distinguishing project1 from project2 if the subdirectories and files contained by both have the same names (especially if project1 needs to use files within project2) If all projects are independent, then clearly when you run an application from project1 you only need to put project1's lib directory into the RUBYLIB environment. If you want to automate this, then create a bunch of files at the top level of your lib tree [project1.rb] $:.unshift "/path/to/project1/lib" [project2.rb] $:.unshift "/path/to/project2/lib" Then your programs can say: require 'project1' require 'base/base' or whatever. (That means you only need to put one extra line at the top of each source file) Just a couple of ideas. B.