[code] ruby_const_update.rb : ver 1.0.0

[code] ruby_const_update.rb : ver 1.0.0

Postby Dan Rathbun » Fri Aug 06, 2010 3:01 pm

[code] ruby_const_update.rb


# Updates older Ruby versions to have constants
# like 1.8.7 and 1.9.x, specifically:
# RUBY_PATCHLEVEL if less than ver 1.8.5-p12


I asked ThomThom to check his Mac, for the values of several Ruby global constants. I wanted to know what the Mac Sketchup 7.x Ruby patchlevel was (as distro'd by Google.)

He replied (in topic Re: PC v MAC webdialog populate,) thus:
thomthom wrote: Mac Mini Intel - OSX 10.5

This is the release date for v 1.8.5 initial (or p0 as it's refered to in 1.9.x)

There were at least 8 patch level updates that followed the initial release in the 1.8.5 branch: p1, p2, p12, p35, p52, p114, p115 and p231. (At least those are the ones I could find that had precompiled binaries. There may have been a few unstable patch levels that didn't "live" long, ie: p11 and p113.)

thomthom wrote:> RUBY_PATCHLEVEL
Error: #<NameError: (eval): uninitialized constant RUBY_PATCHLEVEL>

According to the ChangeLog, the RUBY_PATCHLEVEL constant was added into the codebase on 2006-11-26. So the first patch level it would be valid in would be: v 1.8.5-p2 (Released 2006-12-04.)
* The weird thing is it was bugged in this release, as the constant return 5000, instead of 2.

Note that for Win32, the next available release for the precompiled Legacy One-Click Installer was r22 (which included v 1.8.5-p12, release date 2006-12-25.) And also again for Installer releases r23 and r24. (The latter releases just updated 3rd party DLLs, and SciTE editor, etc.)

thomthom wrote:> RUBY_DESCRIPTION
Error: #<NameError: (eval): uninitialized constant RUBY_DESCRIPTION>

Looks like RUBY_DESCRIPTION and RUBY_COPYRIGHT didn't make it in until v 1.8.7 inital (Released 2008-05-31.)
ChangeLog (from 1.8.7-p299): wrote:Sat May 31 22:11:15 2008 Kazuhiro NISHIYAMA <zn _ @ _ mbf.nifty.com>

* version.c (ruby_description, ruby_copyright): backported from 1.9. bug#19002, [ruby-dev:34883]

* error.c (report_bug): uses ruby_description.

Searching the latest 1.8.5 and 1.8.6 ChangeLog files does not find mention of these constants. (So it seems they were never back-ported to those versions.)

** So, a pure Ruby patch for versions older than and 1.8.7, is in order. **


ver 1.0.0
  • Initial Release - 06 AUG 2010


A pure Ruby patch for versions older than and 1.8.7:
For Sketchup you can put the file in the Tools folder, or the Plugins folder. (You might even have it in a plugin subfolder, and prepend the folder name to the require path in the ruby example statement below. This case is where a developer needs to be sure all users have this file.)
For a full Ruby install you could put it in any of the Ruby folders that are in the $LOAD_PATH (such as "ruby/lib/site_lib/#{ver}")

Usage: At the top of a file in which you'd want to use these constants...

require('ruby_const_update.rb') if RUBY_VERSION<'1.8.7'

No Restrictions.
    I'm not here much anymore. But a PM will fire email notifications.
    User avatar
    Dan Rathbun 
    PluginStore Author
    PluginStore Author

    SketchUcation One-Liner Adverts

    by Ad Machine » 5 minutes ago

    Ad Machine 


    Return to Developers' Forum

    Who is online

    Users browsing this forum: Google Bot and 9 guests