Eric Hodel wrote:
> On Apr 16, 2008, at 00:50 AM, Christian Johansen wrote:
>> 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
> 
> My solution works if ordinarily you distribute myapp as a gem as you 
> avoid the problems with it that Joel pointed out.

Eric, how does that work? Does gem install put a stub in your bindir 
that calls ruby with the -I? Something else?

Looking at what gems did with rake, there is a stub in /usr/local/bin, 
but there doesn't seem to be anything that modifies RUBYLIB or uses the 
-I switch. Maybe there's some magic in the line "gem 'rake', version"?

Is there somewhere in the gem docs that addresses how to use it for an 
application specifically?

Thanks!

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407