Project

General

Profile

Backport #3665 ยป ruby_const_update.rb

RUBY Constant Update (v1.0.0) ruby_const_update.rb - DanRathbun (Dan Rathbun), 08/07/2010 01:07 PM

 
#
# File : ruby_const_update.rb
#
# Author : Dan Rathbun, Palm Bay, FL, USA
# Date : 2010-08-06
# Revision : 1.0.0
#
# Terms : Public Domain
#
# Summary : Updates older Ruby versions to have constants
# like 1.8.7 and 1.9.x, specifically:
# RUBY_COPYRIGHT, RUBY_DESCRIPTION and
# RUBY_PATCHLEVEL if less than ver 1.8.5-p12
#

if RUBY_VERSION < '1.8.7'

if (defined? RUBY_PATCHLEVEL).nil? # versions older than 1.8.5-p2

# we'll check newest versions first

if RUBY_VERSION=='1.8.5' # RUBY_RELEASE_DATE < '2006-12-25' # 1.8.5-p12
#
return RUBY_PATCHLEVEL = 0 if RUBY_RELEASE_DATE=='2006-08-25' # initial
return RUBY_PATCHLEVEL = 1 if RUBY_RELEASE_DATE=='2006-11-02' # p1
return RUBY_PATCHLEVEL = 2 if RUBY_RELEASE_DATE=='2006-12-04' # p2
RUBY_PATCHLEVEL = "'error'"
#
elsif RUBY_VERSION=='1.8.4'
#
RUBY_PATCHLEVEL = 0 # RUBY_RELEASE_DATE=='2005-12-24' # initial
#
elsif RUBY_VERSION=='1.8.3'
#
RUBY_PATCHLEVEL = 0 # RUBY_RELEASE_DATE=='2005-09-21' # initial
#
elsif RUBY_VERSION=='1.8.2'
#
RUBY_PATCHLEVEL = 0 # RUBY_RELEASE_DATE=='2004-12-25' # initial
#
elsif RUBY_VERSION=='1.8.1'
#
RUBY_PATCHLEVEL = 0 # RUBY_RELEASE_DATE=='2003-12-25' # initial
#
#
elsif RUBY_VERSION=='1.8.0'
#
RUBY_PATCHLEVEL = 0 # RUBY_RELEASE_DATE=='2003-08-04' # initial
#
else
#
RUBY_PATCHLEVEL = "'error'"
#
end

else # RUBY_PATCHLEVEL _IS_ defined

if RUBY_VERSION=='1.8.5' # 1.8.5-p2
#
# 1.8.5-p2 RUBY_PATCHLEVEL returned 5000 instead of 2
#
if RUBY_RELEASE_DATE=='2006-12-04' && RUBY_PATCHLEVEL==5000 # p2
RUBY_PATCHLEVEL = 2
elsif not RUBY_PATCHLEVEL==2
return if RUBY_RELEASE_DATE >= '2006-12-25' # 1.8.5-p12
RUBY_PATCHLEVEL = 2 if RUBY_RELEASE_DATE=='2006-12-04'
else
#
RUBY_PATCHLEVEL = "'error'"
#
end
#
end

# it's 1.8.5-p12 (or higher) OR any version of 1.8.6,
# so RUBY_PATCHLEVEL should be defined

end # defined? RUBY_PATCHLEVEL


# define RUBY_COPYRIGHT and RUBY_DESCRIPTION
#
if (defined? RUBY_PATCHLEVEL)
#
RUBY_COPYRIGHT = "ruby - Copyright (C) 1993-#{RUBY_RELEASE_DATE.split('-')[0]} Yukihiro Matsumoto"
#
RUBY_DESCRIPTION = "ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE} patchlevel #{RUBY_PATCHLEVEL.to_s}) [#{RUBY_PLATFORM}]"
#
else
#
$stderr.write('Error: in "ruby_const_update.rb", RUBY_PATCHLEVEL could not be defined.')
#
end
end # if RUBY_VERSION < '1.8.7'
    (1-1/1)