Yasushi Shoji <yashi / yashi.com> writes:

> I realized the other day, when I tried to create class Version, that
> creating class Version which is generic enough to satisfy all the
> version scheme we have is very close to impossible.
> 
> So I ended up with a class for Ruby versioning scheme with only what I
> need. constructor for a String, an Array, and Integers, #major,
> #minor, #teeny, and #<=> for Comparable.

> any one has better idea?

Not better, but perhaps additional.

Should a library's version information also be used to record
dependencies?

   module Wombat

     Version "1.2.3" {
        requires "marsupial"               # no qualifier means any version
        requires "eucalyptus" :> "1.0"     # at least this version
        requires "sleep" :> "0.9" :< "1.5" # in range
        requires "skippy" "5.4"            # exact (same as :== "5.4")
     }

   end


We can query a module's version information from the outside

  Wombat.version   #=>  Version(1.2.3)

  Wombat.requirements.each {|req| ...

and so on. I _think_ this can all be implemented at the Ruby level.


Looks scary, but it puts all the dependency stuff in one place, which
will greatly help in the grand unified library project (gulp).

Dave