[Rubygems-developers] check gem version before gem installation? (or: how to add rubygem version dependencies now that there is no 'rubygems' gem?)

Eric Hodel drbrain at segment7.net
Thu Sep 18 15:14:20 EDT 2008

On Sep 18, 2008, at 11:02 AM, Nate Murray wrote:

> Hey all,
> I've just created a new gem. I'm using hoe 1.7.0 and it uses the
> rubygems method "add_development_dependency" which was added approx
> rubygems 1.2.0.

I don't see what this has to do with your gem.  There is a bug in  
RubyGems 1.2 with respect to development dependencies, but gems  
packaged with RubyGems 1.2 are backwards compatible with older  
RubyGems versions.

> In order for my gem to install correctly it needs to run a rake task
> to finish installation.

You cannot run custom code upon installation of a gem.

> If one installs the gem with rubygems version
> < 1.2.0. Then 1) the gem will "install" (place files in the gems home)
> but 2) the rake task fails because it cannot find the method
> "add_development_dependency" and installation does not complete.

If the user needs to run a task after installation via the Rakefile  
then you need a runtime dependency on hoe.

If hoe isn't backwards compatible, then you need to file a bug against  

> As I understand it, I cannot just add a requirement of rubygems >=
> 1.2.0 because there is no longer a rubygem gem. (is this accurate?)

There never was a rubygems gem you could depend on.  Use  

More information about the Rubygems-developers mailing list