Getting SketchUp to play nicely with RubyGems?
-
So, this means that you can easily adress all ruby code from within Sketchup ruby? Eg. to use rexml?
Are there any know limitations on what version of ruby one can use with sketchup and what not? -
@pout said:
So, this means that you can easily adress all ruby code from within Sketchup ruby? Eg. to use rexml?
(1) We always could.. IF the proper search paths (for the require method,) are added to the $LOAD_PATH array, AND the machine has a full Ruby install, at those path locations. See:
[code] loading from the Standard Ruby Libs
[code] Ruby LOAD PATHs script for (Win32)(2) One of the issues we are discusing in this thread, is a computer having 2 groups of Ruby installations.
- One that is installed in the NORMAL location (C:/ruby) for **Non-*Sketchup use. A separate install location (either under the Sketchup dir, or under the Google dir,) that is ONLY for Sketchup use. This is "partly" the way it is on the Mac, but not all extended libraries were included (if any,) but the dir structure is there.
@pout said:
Are there any know limitations on what version of ruby one can use with sketchup and what not?
I discussed this earlier in this thread, on Win32 so far we must stay in the v.1.8.x branch; as Sketchup calls the Ruby C function rb_set_kcode() on startup. Ruby v.1.9.x has renamed that function, but did not alias from the old function name (Ruby's fault, not Google's.)
I just tried to preset kcode with the interpreter command line arg "-K U" stored in ENV var RUBYOPT, but Sketchup still insists on calling rb_set_kcode(). So for now, no using v.1.9.x branch Ruby interpreter.
ALSO, just because you can load a certain version of Ruby, does not mean that ALL libraries will work with Sketchup. Sketchup is loading Ruby as an embedded subprocess, and not all of the Ruby extended libraries can work when Ruby is loaded this way.
- One that is installed in the NORMAL location (C:/ruby) for **Non-*Sketchup use. A separate install location (either under the Sketchup dir, or under the Google dir,) that is ONLY for Sketchup use. This is "partly" the way it is on the Mac, but not all extended libraries were included (if any,) but the dir structure is there.
-
@dan rathbun said:
There is an override in pik that lets me install Ruby versions to a custom path (instead of %HOMEPATH%/.pik ) Does RVM have this as well ?
@Rich ... the RVM website says on the Command Line Interface page:
http://rvm.beginrescueend.com/rvm/cli/... that RVM does have an option for you to specify a custom location for a "rubyset"
it's option: --prefixI'd imagine it would be used with an install action, maybe something like:
%(#804000)[rvm install ruby-1.8.5-p231 [*flags*] --prefix /Library/Application Support/Google SketchUp 7/SketchUp/ruby/]
- verify with your gurus on the RVM IRC
Without knowing more about what's going on under the Applications dir tree, I can't recommend yet installing to:
%(#804000)[/Applications/Google/SketchUp 7/SketchUP.app/Contents/Frameworks/Ruby.framework/Versions/B/]
-
@unknownuser said:
Ruby LOAD PATHs script for (Win32)](http://forums.sketchucation.com/viewtopic.php?f)":1xbd78u2]
I am trying to write a plugin for sketchup 8 using rubygems....
About the initial load error now, whenever I uncomment the #$LOAD_PATH << "#{pre}/site_ruby/#{ver}" line
(the directory containing the rubygems file among others), sketchup crashes during launch.It is NOT likely you will get a standard RubyGems to work with Sketchup.
One problem may be that RubyGems redefines the Kenel.require() method, which is inherited by Object, and so inherited by all other Ruby objects.
For info on RubyGems, see the Resources list
under the section: TECHNICAL REFERENCESIt is more probable that a special version of RubyGems would be needed for use under Sketchup.
Advertisement