Notice: The template does not work with Xcode 3. I'll try to get it fixed when I get time.

Notice: This is experimental code and may contain bugs. Please report any bugs in the template itself to awh -at- acm -dot- org (replacing -at- and -dot- with the appropriate characters). JRuby bugs should be reported through the JRuby site.

This is an Xcode template for building self-contained JRuby application bundles for OS X. Generated application bundles work like normal OS X apps. They have regular OS X menu bars, Finder icons, and dock icons. You can drag them around to different locations, zip them up and put them on the web, etc. It all Just Works™ (modulo any bugs).

The template uses Charles Oliver Nutter's new "Ruby in a Jar" (jruby-complete.jar) package. As Charles points out, this is experimental JRuby trunk code, so you may encounter bugs. As he also points out, that's part of the fun of it. :-)

I've built and run a few simple test applications using the template on both my Intel Macbook and my G5 Power Mac. I've also tested the resulting applications on an iBook G4 (I haven't tested compilation on the G4, but have no reason to think that it won't work). All seems well so far, but this doesn't really qualify as extensive testing.The template itself should also be considered experimental at this stage.

Installation:

1) First, make sure you have a current version of the Apple Developer Tools installed (obviously).

2) Download and unpack the zip file. This should produce a folder called JRuby Application.

3) Download the latest jruby-complete.jar from Charles's site (or check out the source using svn and build your own).

4) Place the jruby-complete.jar file inside your JRuby Application folder (right alongside JRubyApp.icns, JRubyApp.java, and JRubyApp.rb).

5) Drag the JRuby Application folder to /Library/Application Support/Apple/Developer Tools/Project Templates/Java (if you want to install the template for all users on the machine) or ~/Library/Application Support/Apple/Developer Tools/Project Templates/Java (if you want to install it just for the current user. In this case, you may need to create the intermediate folders first).

6) Start Xcode and create a new project. You should see JRuby Application as an option in the Java section.

7) Put your custom Ruby code in <project name>.rb

5) Build and go. That's it!

Upgrading:

Since jruby-complete.jar is bleeding-edge, it's almost certain that it will be changing regularly. When that happens you should be able to easily upgrade the template. Just download or build the new jruby-complete.jar, then drag it into the JRuby Application template folder. New projects will be created using the new jruby-complete.jar. Existing projects will need to have their jruby-complete.jar file replaced by hand.

Here are some screenshots to pique your interest:

 

JRuby application bundle running. Note that the menu is in the proper Mac position at the top of the screen. :-)

 

Application's dock icon . This is the default icon used by the template, but you can replace this with your own .icns file and it should work fine.

Have fun!

-- Tony Hursh