From: Robert Klemme Date: 2004-02-09T10:43:43+09:00 Subject: Re: Is 1.8.2 imminent? And detecting Rubyx version Maybe this old posting (Nov 25th 2003) of mine helps: > > "Ara.T.Howard" schrieb im Newsbeitrag > news:Pine.LNX.4.44.0311241336440.28055-100000@fattire.ngdc.noaa.gov... > > > > > > any better methods of require a specific version/set of versions? > > A bit more complicated, but could be included in the std. distribution... > > module Kernel > def ensure_version( ver ) > if ( RUBY_VERSION.split(/\./).map{|x|x.to_i} <=> > ver.split(/\./).map{|x|x.to_i} ) < 0 > throw "Version error: should be #{ver} but is #{RUBY_VERSION}" > end > end > end > > ensure_version "1.7.0" > ensure_version "1.8.0" > ensure_version "1.8.1" Kind regards robert "Andrew Walrond" schrieb im Newsbeitrag news:200402061042.49252.andrew@walrond.org... > 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 > > > >