On 1/5/07, bbiker <renard / nc.rr.com> wrote:
>
> Eric Hodel wrote:
> > On Jan 5, 2007, at 10:57, Jason Roelofs wrote:
>
> > > Though newest version of gems now has just
> > >
> > > gem 'gem_name', '>=1.2.3'
>
> Sorry, I think I posed my question badly.
>
> I meant how do you specify a version or other constraints with
> "require"
>
> for example:
> require 'gem_name'
>
> require can only take one parameter
>
> thus require 'gem_name', '>=1.23'  responds with:

you need three commands:

1. require 'rubygems' # may be omitted when RUBYOPT=-rubygems or ruby
is started with -rubygems

2. gem 'gem_name' , '>=1.23' # this sets the required version and this
is what eric wrote about

3. require 'gem_name' # to actually require the file - no version or anything

Actually the gem_name in he steps 2. and 3. may be different - one is
the name of the gem (win32-shortcut for example) while the latter is
the name of the file to be required (win32/shortcut)

If and only if you'll see undefined method 'gem' in the second step,
then replace 'gem' with 'require_gem' (meaning you have an old version
of rubygems, and you might want to upgrade)