I just added this to Version:

  def assert_spermy expect, version
assert_equal expect, Gem::Version.new(version).spermy_recommendation
  end

  def test_spermy_recommendation
    assert_spermy "~> 1.0", "1"
    assert_spermy "~> 1.0", "1.0"
    assert_spermy "~> 1.2", "1.2"
    assert_spermy "~> 1.2", "1.2.0"
    assert_spermy "~> 1.2", "1.2.3"
    assert_spermy "~> 1.2", "1.2.3.a.4"
  end

The idea being that tools like hoe and rubygems can use it to help recommend better dependency specifiers. Right now in hoe if you don't have a version specifier on a dependency it tells you that you should at least add "> 0" and this would offer a vast improvement. Eventually I'd like to push rubygems into if not deprecating then at least warning against using ">=" specifiers (when used alone).

See also: http://blog.zenspider.com/2008/10/rubygems-howto-preventing-cata.html

I also added part of that blog post to the doco on version and pointed to it from the top level rdoc.

_______________________________________________
Rubygems-developers mailing list
http://rubyforge.org/projects/rubygems
Rubygems-developers@rubyforge.org
http://rubyforge.org/mailman/listinfo/rubygems-developers

Reply via email to