From: Andrew Walrond Date: 2004-02-06T19:42:54+09:00 Subject: Re: Is 1.8.2 imminent? And detecting Rubyx version On Friday 06 Feb 2004 10:03 am, Mauricio Fern�ndez wrote: > On Fri, Feb 06, 2004 at 04:58:03PM +0900, Andrew Walrond wrote: > > I'm holding off an 'official' release of Rubyx (ruby based linux distro) > > because it hits some bugs in 1.8.1 which have been fixed in cvs > > > > I was wondering whether anyone knows when 1.8.2 will be released? > > > > Otherwise, is there a way of detecting a version of ruby, which also > > covers dated stable snapshots? > > > > Eg Rubyx needs stable-snapshot-2004-01-14.rar or newer. How can I test > > for it? > > VERSION and RUBY_RELEASE_DATE Thanks! My implementation seems messy though. Can anybody think of how to clean it up? #Need ruby 1.8.1 stable snapshot >= 2004-01-14 catch :ok do puts("Detected ruby version #{VERSION}, released #{RUBY_RELEASE_DATE}") VERSION =~ /(\d*).(\d*).(\d*)/ v1,v2,v3 = $1.to_i,$2.to_i,$3.to_i RUBY_RELEASE_DATE =~ /(\d*)-(\d*)-(\d*)/ d1,d2,d3 = $1.to_i,$2.to_i,$3.to_i throw :ok if v1 > 1 or (v1 == 1 and v2 > 8) or (v1 == 1 and v2 == 8 and v3 > 1) if v1 == 1 and v2 == 8 and v3 == 1 throw :ok if d1 > 2004 or (d1 == 2004 and d2 > 1) or (d1 == 2004 and d2 == 1 and d3 > 13) end raise "Rubyx needs ruby version 1.8.2 or a 1.8.1 stable snapshot released after 2004-02-13" end