Getting SketchUp to play nicely with RubyGems?
-
@richmorin said:
I agree that it could be useful to have public references for configuration information (eg, directory trees, control files) used by SU on various platforms. ... More generally, where should persistent resources such as this be posted?
They should have beeen already posted to the Google API docs, but well the docs appear to be the lowest priority of all. Jim set up an alternate (prototype,) API doc site on the SKX Google Code site. That would be a good place, for now as we can edit it, format it nicely, etc. The GSUT could always cut & paste it over to the main API site, when we have it done, then Jim could replace the content with the link. (If you feel better about having on a Google server, so it could be taken down, if the GSUT requested it. Putting it on Github would mean it would always be there or in some archive, especially if you have the free gith, as opposed to a paid site.)
File directory listings are just listings of files. Anyone can do that. The 'Real' intellectual property is all within compiled files. The terms of use prohibit decompiling and reverse engineering. We're not doing that.
Plist files. The API gives us 2/3 methods for reading and writing into the defaults (Registry on Win32, plist on Mac,) but doesn't enumerate the actually settings. We've had to poke into the Registry ourselves to discover the keys and attribute names. There are numerous posts on this forum where WE and GSUT members have revealed these keys and Attributes, with no 'slap down', because we are expected to know them. (Meaning if we're smart enough to know we need them, we are also smart enough to know how to use REG.exe or the regedt32.exe or the standard Ruby lib Registry to get the info we need. Same on the Mac, for a plist file reader.)
@richmorin said:
I agree that it would be preferable for both the Mac and Windows versions of SketchUp to have the same (reasonably current) version of Ruby. However, this should be done in a way that keeps existing plugins working smoothly for naive users.
Which is WHY, you and I, are experimenting with a Ruby Version Management utility (RVM and pik, respectively.) Developers need to be able to test their code easily with a variety of Ruby packages (versions + libs + gems, etc.) so they can avoid (as much as possible,) the user complaints that could come flooding in after release, is "Your Plugin interfers with gen such-and-such", or "conflicts with standard library Encoding" or whatever.
@richmorin said:
So, perhaps we need a way for experienced users to "opt in" to a newer version of Ruby, etc.
DITTOS!!! It is so hard for me to understand why a programmer would hardcode the loading of a specific Ruby version. It's crazy. On Win32 they could have made it a Registry setting, or even better JUST put the rbconfig.rb (that is created for the Ruby version,) in the Sketchup folder and loaded it. We then could have tweeked that file. (That file really belongs in the ruby/lib/ruby/#{RUBY_VERSION}/#{RUBY_PLATFORM} directory.)
Anyhow, even an .ini/.plist file so we users could tell Sketchup how and what Ruby to use, is a "no-brainer."From what you have said.. it looks like 'redirecting' SU to another version on the Mac is much easier (then Win32,) as they used a symbolic link.
If it was me (with the Mac,) I'd backup everything, install a newer version as 'B' and change the symbolic link 'Current -> B' and see if it works. Either way the results of the test are valuable. (I DO notice that the SAPI is also version 'A', I do not know if they both must be 'in sync' or if there is another SAPI specific symbolic link [you didn't say.]) -
@richmorin said:
Can anyone comment on the legalities here?
reference: The Legal Agreement, entitled: "Terms of Service"
section 10.3 is of most interest, as to what we CAN do and NOT do with the API. (I will not quote it as the actual document should always be refered to. It could be revised, etc., making my quote worthless.)
section 8.2 is of interest to Google's right to filter content on Google's Services (which applies to the Google Codesite as well and is stated in all Google "Terms of Service" agreements.)
So then I think that Jim's SKX codsite API wiki would be the best place to "prototype" the information, and then let the Google SketchUp Team check it out. I know Scott Lininger is a SKX project member so he can edit/delete stuff on the wiki. You would have to join the project, or else email/PM Jim or I the info, and let us post it.
-
Now I got some questions here - is this a plugin that is going to be distributed?
I would not be comfortable with a plugin changing the Ruby version SU loads.
What if another plugin tried to make SU use another version? Sounds like there's potential for a clash. Since the SU Ruby environment is shared by an unknown number of other plugins, any changes to the core is something that can potentially break something else. -
Check this out, a guy named Andre claims to have gotten SU to load 1.8.7 on Mac/OSX:
http://groups.google.com/group/sketchupruby/browse_frm/thread/fc4278c7a2011582#His site with the instructions:
http://superuser.com/questions/167453/I hope he made backups.
-
@thomthom said:
Now I got some questions here - is this a plugin that is going to be distributed?
ThomThom... how can it be a plugin ?
You can't switch horses in mid-stream.
My interest is controlling MY ruby versions, for the purpose of testing code against differing Ruby versions and Patch Levels. In order to do that, a developer needs multi-version ruby installs and a switching utility.
On Win32... it's pik.
On Unix-like (Linux, OSX, etc.) it's RVM. (Ruby Version Management)
Both are command line utilites.
Both are aimed at Standard Ruby use.NOW... I am contemplating having 2 RVM archives. ONE that is normal, that I use for NON-Sketchup Ruby (Rails, eRuby, Distributed Ruby, etc.)
A Second archive, that (like on the Mac,) is installed beneath the Sketchup Application folder (or maybe in the Google folder.) The second would only be used with, or tweeked specially for Sketchup.
So if I wish to test my plugins on v1.8.0 and v1.8.5 and v1.8.6 ..etc.. I need a means of quickly switching back and forth (when Sketchup is NOT running.)Updating the Ruby version that Sketchup loads is up to the user. Currently on Win32 it's a manual task.
I strongly believe that Sketchup should be "Ruby Version Agile", but that will require a change in the exe source.
-
Will all these 'investegations' also lead to a directory structure of the ruby lib?
I think there are a lot of interesting tools (like an xml parser) which could be used in plugins, but making it work atm is something i have not been able to.
To much files needed spread over several places. -
@pout said:
Will all these 'investegations' also lead to a directory structure of the ruby lib?
I think it's best to keep the dir layouts the same (I in fact have manually copied a whole ruby install into the Sketchup folder.)
So the Sketchup copy just begins in dir:
C:/Programs/Google/Google Sketchup 7/ruby
instead of:
C:/ruby -
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