From: Austin Ziegler Date: 2007-08-21T00:27:01+09:00 Subject: Re: Current rubygems require idiom On 8/20/07, Bil Kleb wrote: > Trans wrote: > > > > Set the evironment var: > > > > $ export RUBYOPT=rubygems > This is for an executable packaged in a gem, i.e., > I have no control over the user's RUBYOPT variable? > > (Note: the gem is also available as a tarball, > hence the initial attempt w/o rubygems.) If that's the case, don't bother doing anything special. Just require your own code. Let's say you've got foo-1.0 with bin/foo that requires lib/foo/foo.rb. If installed as a tarball, bin/foo is installed into your standard bin directory and it will just require 'foo/foo' as normal, because lib/foo/foo.rb will be in SITE_RUBY. if installed as a gem, bin/foo is installed into the gem's directory, and an executable stub is installed into the standard bin directory. The executable stub will do something like "gem 'foo'", and then load "$(PATH_TO_FOO_GEM)/bin/foo". Either way, you'll get the right behaviour. -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca