[Rubygems-developers] [call for participation] - gem dependencies maven-like project specs

Eric Hodel drbrain at segment7.net
Thu Feb 8 13:57:35 EST 2007

On Feb 8, 2007, at 01:17, Jean-Michel Garnier wrote:
> I am working on an small open source project which would help to  
> manage the dependencies of a ruby project (in short: check the  
> versions and download missing gems)
> I have put a short spec on
> http://writer.zoho.com/public/garnierjm/ruby-dependency-management- 
> specs

YAML is great, but Ruby is better.

The gem install command requires you to install all of a gem's  
dependencies before you install the dependent gem.

If you want to check versions and installation of a Rails (or other)  
project just add explicit gem statements in a file:

gem 'rails', '= 1.2.1'
gem 'mysql', '>= 2.7'
gem 'rmagick', '>= 1.14.1'
gem 'test-spec', '= 0.3'

If you want to check versions and install, just run the above code.   
You'll get a Gem::LoadError if a gem doesn't exist:

irb(main):003:0> gem 'foo', '>= 1.0'
Gem::LoadError: Could not find RubyGem foo (>= 1.0)

So you can run the installer to install it through the API, then re- 
run the file.

(It would be easy enough to attach a Gem::Requirement object to the  
Gem::LoadError in the next version of RubyGems.)

> - should be followed by the operator = or >=

Isn't good enough.  RubyGems allows gem requirements to include  
anything that Comparable implements and the ~> operator to match  

> - may ends with the DependencyScoping among enum(default, provided,  
> development)

You can get this behavior by having multiple files with gem commands  

More information about the Rubygems-developers mailing list