From: Jeremy McAnally Date: 2007-01-21T14:03:52+09:00 Subject: Re: Getting the version number for rubygems? require 'rubygems' unless Kernel.respond_to? :gem alias gem require_gem end gem 'ruport' That should work I believe... --Jeremy On 1/20/07, Gregory Brown wrote: > On 1/20/07, Eric Hodel 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. > > -- My free Ruby e-book: http://www.humblelittlerubybook.com/book/ My blogs: http://www.mrneighborly.com/ http://www.rubyinpractice.com/