Rubycocoa embedded ruby interpreter

rubies-

  I have asked before but it got lost in the shuffle. I am working on a bunch of rubycocoa apps for the newspaper I work for. And it is time to deploy them on other machines. I would really like to be able to embed the ruby interpreter binary and the libs I need inside of the OSX .app executable. Does anyone out there know how this could be done? Or maybe have already done so? SHould I be looking at rubyscript2exe's osx support to see how that works?

  I would really appreciate any direction on this as I am at a loss and really need this functionality.

Thanks ever so much

-Ezra

I "spiked" on this a while back. You have several options, especially once you fire up Xcode.

Rubyscript2exe worked well the first time I tried it. I even threw Rails + FXRuby at it. I followed the documentation and I had Windows and OS X executables, as advertised. It even handled project-relative file paths just fine.

Now, if I recall correctly, rubyscript2exe expands its contents into a temp directory. That took a noticeable amount of time with my app. I think it may need to repeat the expansion every time you launch the app, but I could be wrong.

More recently, I tried rubyscript2exe again on the same app: more code, but nothing else different. I kept running into "too many open files." As far as I can tell, there is no fix or workaround on OS X. The culprit is some rubyscript2exe file manipulation code. It does look possible to debug and perhaps fix this code.

"Programming Ruby" (the pickaxe) chapter 21 is a good guide for embedding Ruby. After some determined fiddling with Xcode, I was able to write a simple nicely-packaged Cocoa app that called Ruby code. Unfortunately, in my naive approach, Rails didn't load its required files. I'm pretty sure that with a better understanding of Objective-C, Xcode, and embedded Ruby, this approach should work just fine.

In the end, the FXRuby part of my app always runs on dev machines, so I made a .term file that kicks off a bash script. That's really all I need, though it bugs me that I don't have a nice icon on in the dock.

You may have an easier time of it with RubyCocoa, but then again, I wonder if RubyCocoa embedded in a real Cocoa app might be like putting two Siamese Fighting Fish in the same tank?

Hope that is of some help,
Scott

···

On Jan 24, 2006, at 4:00 PM, Ezra Zygmuntowicz wrote:

rubies-

  I have asked before but it got lost in the shuffle. I am working on a bunch of rubycocoa apps for the newspaper I work for. And it is time to deploy them on other machines. I would really like to be able to embed the ruby interpreter binary and the libs I need inside of the OSX .app executable. Does anyone out there know how this could be done? Or maybe have already done so? SHould I be looking at rubyscript2exe's osx support to see how that works?

  I would really appreciate any direction on this as I am at a loss and really need this functionality.

Thanks ever so much

-Ezra

Please take a look at my little script which does this:

   http://www.dcs.gla.ac.uk/~jp/standaloneify.rb

Also, try the rubycocoa mailing list for related questions.

Cheers,
Jonathan

···

On Wed, 25 Jan 2006 09:00:50 +0900, Ezra Zygmuntowicz wrote:

  I have asked before but it got lost in the shuffle. I am working on
a bunch of rubycocoa apps for the newspaper I work for. And it is time to
deploy them on other machines. I would really like to be able to embed the
ruby interpreter binary and the libs I need inside of the OSX .app
executable. Does anyone out there know how this could be done? Or maybe
have already done so? SHould I be looking at rubyscript2exe's osx support
to see how that works?

  I would really appreciate any direction on this as I am at a loss
and really need this functionality.

Jonathan-

  Great thank you very much. i wasn't aware of a rubycocoa mailing list but I will sign up right away. A really appreciate you answering my question.

Thanks so much-

Ezra

···

On Jan 27, 2006, at 8:19 AM, Jonathan Paisley wrote:

On Wed, 25 Jan 2006 09:00:50 +0900, Ezra Zygmuntowicz wrote:

  I have asked before but it got lost in the shuffle. I am working on
a bunch of rubycocoa apps for the newspaper I work for. And it is time to
deploy them on other machines. I would really like to be able to embed the
ruby interpreter binary and the libs I need inside of the OSX .app
executable. Does anyone out there know how this could be done? Or maybe
have already done so? SHould I be looking at rubyscript2exe's osx support
to see how that works?

  I would really appreciate any direction on this as I am at a loss
and really need this functionality.

Please take a look at my little script which does this:

   http://www.dcs.gla.ac.uk/~jp/standaloneify.rb

Also, try the rubycocoa mailing list for related questions.

Cheers,
Jonathan