Hello all, I'm an experienced Mac developer trying to add Ruby to my toolbox. Most of my previous experience is with Python, Tcl, Objective-C, and AppleScript, and I'd like to add Ruby as well. My interest in MacRuby stems in large part because it appears to have vastly superior app deployment tools than are found in standard Ruby, which are non-existent. I had a few questions about MacRuby and its differences from standard C-Ruby: 1. Is MacRuby mature enough to function as a drop-in replacement for standard Ruby? Are there significant gaps in functionality? Specifically, does ffi work? (I tried to run a "hello world" ruby-tk app using the ffi and ffi-tk gems, but MacRuby just segfaulted with an error code of 11.) 2. Is it possible to have a command-line toolchain/workflow for development and deployment of MacRuby apps, or is heavy use of Xcode required? Here's a bit more about my specific use case for MacRuby: I develop desktop apps using scripting languages; most of my experience to date has been with Tcl/Tk and Python/Tk, dropping down into Objective-C or C where necessary for speed or integration with specific API's, using just a basic text editor-Terminal workflow. (I'm one the maintainers of Tk on the Mac.) My apps integrate heavily into Cocoa or Carbon API's when necessary to implement stuff like NSServices, AppleScript support, etc. Both Tcl and Python have excellent support for deployment of desktop apps (Tcl has an entire standalone app environment, while Python has py2app and related tools). Standard Ruby has no such tools on the Mac whatsoever. I like the fact that MacRuby would make AppleScript support for my app easy, and the macruby_deploy tool seems to be what's missing from standard Ruby--gathering all bits and libs into an app bundle, running install_name_tool where necessary, etc. The segfault with ffi-tk, however, has me concerned (this particular lib has been advertised to work with any and all Ruby implementations including JRuby). Any guidance on these questions is apprecaited. I hope I'm able to move forward with a new app idea with MacRuby. Thanks, Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com
On Thursday, June 21, 2012 at 5:46 PM, Kevin Walzer wrote:
Hello all,
Hi! and Welcome!
I had a few questions about MacRuby and its differences from standard C-Ruby:
1. Is MacRuby mature enough to function as a drop-in replacement for standard Ruby? Are there significant gaps in functionality? Specifically, does ffi work? (I tried to run a "hello world" ruby-tk app using the ffi and ffi-tk gems, but MacRuby just segfaulted with an error code of 11.)
The answer to this question is slightly complicated: * MacRuby passes ~90% of the rubyspec. * The only "significant" gap, to the best of my knowledge, is Fibers. That said, there is a rather clever implementation of Fibers on top of GCD from alskip (https://github.com/alskipp/MacrubyFibers), which I've been meaning to integrate. * There are still issues running Rails, so if you want to use that as a benchmark, MacRuby is "not quite there yet" As for FFI, it does not work. Part of the reason is that we had been waiting for the API to settle (early on there were various competing ideas of how Ruby FFI should work). Presently, it is probably as settled as it will get, so it would be good to look into an implementation.
2. Is it possible to have a command-line toolchain/workflow for development and deployment of MacRuby apps, or is heavy use of Xcode required?
A command-line only workflow is definitely possible. I have used such a workflow in the past. Depending on what you are attempting to do, it may involve xcbuild, so you would still need Xcode installed, but compilation and linking can all be done without Xcode. That said, many people have found Xcode helpful when designing UIs. We could probably do a better job of providing a way to make UIs without Xcode.
I like the fact that MacRuby would make AppleScript support for my app easy, and the macruby_deploy tool seems to be what's missing from standard Ruby--gathering all bits and libs into an app bundle, running install_name_tool where necessary, etc. The segfault with ffi-tk, however, has me concerned (this particular lib has been advertised to work with any and all Ruby implementations including JRuby).
Until FFI is more fleshed out, you might also try using the Tk.framework in MacRuby. You should be able to use it similarly to how you might use it from Obj-C (though, I am wholly unfamiliar with Tk). You can load the framework in MacRuby by using the "framework" command:
framework "Tk"
The framework will be loaded using the BridgeSupport definition file, which is a kind of FFI. If you run into any problems, be sure to let us know. Cheers, Josh
participants (2)
-
Joshua Ballanco
-
Kevin Walzer