IPC with Ruby 1.8.5 - ruby

I need to do IPC with Ruby 1.8.5. The catch is that it's the Ruby that ships with Google SketchUp, and is only a subset of the full Ruby API. So for instance, there's no Socket class, and no DRb.
What are some other way's of doing IPC with Ruby? Anything that uses the File class, like memory mapped files, or something like that? I'm completely new to IPC, so I apologize if I missed something obvious.

The latest version of SketchUp ships with Ruby 1.8.6. You can download (if you haven't already) the core Ruby API, and just require whatever files you need, to implement your script.
Testing non-SketchUp Ruby code, is much easier outside of SketchUp, with the command line, or an editor like SciTE. Then you can add your SketchUp code for tests within the application.
Ruby Download
SciTE Download

Related

Can I use Ruby with Shoes for GUI for a multiple choice test app?

I'm trying to make a simple multiple choice question app. Is this possible on ruby?
I've tried using shoes but I don't know how to create multiple classes and a GUI that uses them.
I'm also trying to connect all of this to a database.
I'm having trouble in understanding how to connect all of this together.
According to the comments the main problem seems to be with using the mysql gem part.
Gem usage depends on the version of shoes you are using. For green_shoes you should be good with the standard gems, but it is unmaintained. Shoes 3.1 has problems with gems that have C extensions (such as mysql). Shoes 3.2 should work. With Shoes4 you can't install the normal Ruby gems with C extensions as it uses JRuby and C extension support in JRuby is disabled. You have to use different gems to connect to the database, functionality is the same. A starting point might be activerecord-jdbc.

Is it possible selecting a non system Ruby from TideSDK when launching or bundling an application?

I'm testing the bundling of applications including Ruby scripts using TideSDK, via the TideSDK Developer app.
I have several Rubies installed on my system, using RVM, and was wondering if there is any way of specifying which one should be used using a .rvmrc file or something similar that the TideSDK ruby module can understand.
Thanks.
how are you planning to run your ruby scripts? via Ti.Process? Otherwise, the TideSDK ruby module is what it is - there's no different versions you can use with rvm (Afaik).
Update/Expanded: I should point out TideSDK bundles its own Ruby - its not using the system ruby.
Otherwise, you can execute ruby scripts via Ti.Process (like any other script you would execute from the CLI). So, in your script, instead of #!/usr/bin/ruby you could do #!/usr/bin/env ruby. Of course, this wouldn't be very portable if you relying on rvm on target systems, but if you are doing a limited ditrib to known targets (ie: internally where you know everyone has a system setup with rvm) you could probably get something working.

Deploying Ruby-Tk app on OS X

I'm looking for a straightforward way to deploy a standalone Ruby-Tk desktop app on OS X. All existing options for deploying desktop Ruby GUI apps on the Mac (e.g. standaloneify.rb) assume that you are using RubyCocoa or MacRuby, and are tightly bound to Xcode/Interface Builder project structure; or, alternatively, that you are wrapping a simple script via Platypus that does not involve deploying the entire Ruby runtime. None of the other existing options that I've found--rubyscript2exe, ocra, crate--support the Mac and/or support Ruby 1.9.
I'm hoping that someone can point me to a shell script or Ruby script that does the following:
Tracks all dependencies/gems in an app.
Copies the Ruby interpreter and dependencies into an application bundle.
Runs install_name_tool on the Ruby interpreter and all dylibs to make them portable.
The application bundle can either be something created by Platypus, use a Cocoa stub launcher, or even a shell script--I know how to handle those. The problem I'm having is getting the Ruby runtime wrapped in a portable way.
There's a rakefile at http://weft-qda.rubyforge.org/svn/trunk/weft-qda/rake/rake_osx.rb that encompasses the tasks that I'm looking to achieve, but this rakefile is part of a larger build structure that I can't get running on my Mac. I'm not familiar enough with rakefile structure to refactor this into a simple script that I can run, either via "ruby rake_osx.rb" or even "rake".
If someone can suggest to me how to modify this rakefile to run independently, or point me to another example project, or even share some code, I would be grateful. The project I am working on is better suited for Ruby than Python (better library support in Ruby), but I am not going to invest time in it if deployment won't work. (Python has a much richer tradition of deployment tools than Ruby, something I'v never quite understood.)
This is a bit late after the fact, but in classic fashion, since I could not find a desktop app deployment tool for Ruby-Tk on the Mac, I wrote my own:
ruby2app
ruby2app is a simple command-line tool, inspired by similar Mac tools like py2app for Python, that bundles a Ruby script with the Ruby runtime into a standalone Mac application. It reads a basic configuration file to find the appropriate Ruby installation, compiles a small C program that embeds the Ruby interpreter, copies the entire Ruby installation into the application bundle, and re-links the relevant libraries with the main executable.
It attempts to provide for the Mac what ocra and exerb provide for Windows. Hopefully this will be of use to others.

Can I switch versions of Ruby dynamically using RVM?

I'm working on building a GUI for my checkers implementation. I'm utilizing a GUI framework that only works with Ruby 1.8, yet my game engine, which I have packaged as a gem, only works with Ruby 1.9.
I can't change the code for the GUI framework and reworking my game engine to make it compatible with 1.8 is undesirable, to say the least.
I'm using RVM though, and it looks like you can write RVM scripts to change Ruby versions on the fly.
Does anyone have any experience with that or what the script might look like?
You could run it in two processes. Give the GUI a 1.8 process and talk to it via a shared db or an API on the other side. That's how I'd do it. The good part about that is you can have on online version of your game as well because other clients will be able to talk to it as well.
You can't run one app with two versions of Ruby. How do you imagine this?
RVM has an ability to automatically change current ruby when you cd into a directory. Just create in that directory a file called .rvmrc with content like
rvm use 1.8.7

Is possible to use QtConcurrent with Ruby (mingw-32)?

How can I use the QtConcurrent Qt module in Ruby?
I'm developing a small app that uses Qt (through the qtbindings binary gem) in Windows (Ruby 1.9.3 mingw-32) but I couldn't find a way to use threads (or use simple concurrent methods calls).
Any help and any example would be very helpful.
Thanks in advance.
I have a feeling that its no different than PyQt4, where QtConcurrent is not available because they can't easily wrap it. If its not being built with your Ruby bindings, its probably not available. You would need to stick to QThread and its siblings.

Resources