Gregory Brown
1/21/2007 4:50:00 AM
On 1/20/07, Eric Hodel <drbrain@segment7.net> wrote:
> On Jan 20, 2007, at 20:11, Gregory Brown wrote:
> > In ruport I have a tool that generates a bunch of boilerplate code for
> > folks, and in it, I use require_gem to lock the files down to a
> > specific version of Ruport.
> >
> > I'd like to make this friendly to RubyGems 0.9.1 by using the gem
> > method rather than require_gem when people have 0.9.1, but want to
> > generate require_gem for older versions.
>
> Just use #gem, and don't bother being backwards-compatible. RubyGems
> older than 0.9.1 has a serious security exploit. (About 20% of
> rubyists are running a version of RubyGems without #gem (prior to
> 0.9.1's release).)
I'll probably do this by the next release, but the one coming up in a
week or two i'd like to give people a bit of grace period.
> > So basically, is there a constant or method I can call that'll give me
> > back the version of rubygems that i'm running?
>
> Don't think so hard:
>
> require 'rubygems'
> Kernel.respond_to? :gem
Yep, that's better. thanks.