From: Christian Johansen Date: 2008-04-16T16:50:41+09:00 Subject: Re: How to reliably setup require path Joel VanderWerf wrote: > Eric Hodel wrote: >> The simplest way is `ruby -Ilib bin/myapp` from the root of the project >> dir. >> >> (-I directories take precedence over RUBYLIB directories.) > > Also, it's fragile with respect to the cwd. You have to be in myapp/ to > run it, and also the program can't Dir.chdir without breaking the > reference to the lib dir. Exactly, and this was my original problem as well.I think I'll go with Eric Hodels solution for now. Also, I will put the code behind the binary in myapp/lib/myapp/command.rb I have organized my files such that mostly there's one class per file. This means modules are spread over several files. Is it a good idea to create a file named after each module which requires all the files belonging to the module? Then I could require all the modules in myapp/lib/myapp.rb so that require 'myapp' from another app will give direct access to all my classes and modules. Is it good? :) -- Posted via http://www.ruby-forum.com/.