Category Archives: engineering-log

Ruby on Rails tutorials

Here’s a bunch of RoR tutorials from the web. The canonical book on the topic is Agile Web Development with Rails.

Ruby on Rails development on Mac OS X

Getting RoR installed is pretty easy with Locomotive, an entirely self-contained RoR environment for Mac OS X (there is a Windows equivalent called Instant Rails). This means no installing all the pieces, and no messing up of anything in Mac OS X (which includes Ruby these days). You just drag the application into your Applications folder and you are good to go. However, it also means that any other tool or application that needs to call Ruby has to be configured to use the version installed inside Locomotive (which is really a bundle that includes the application and all the RoR components).

The hip text editor for RoR on the Mac is TextMate. However, it’s a commercial application and has no API for Hackystat hooks, so I’m avoiding it for now.

The best alternative (for Eclipse users) appears to be RadRails. It’s available as a standalone editor (a customized version of Eclipse) or as an Eclipse plugin. Annoyingly, RadRails is currently in transition as Aptana (a company that makes an open source JavaScript/AJAX editor plugin for eclipse) takes over the development from the original developers. This means the documentation and website is a bit of a mess right now.

Pieced together from various web pages, here is how to get up and running with RoR on Mac OS X (assuming you have Eclipse 3.2.X already installed):

  1. Download Locomotive and drag the Locomotive icon into your Applications folder.
  2. Install RDT and RadRails Eclipse plugins. Aptana has the links in their RadRails docs.
  3. Configure RadRails to use RoR embedded in Locomotive. Due to the RadRails documentation transition right now the wiki with the instructions is only available from Google’s cache, but here it is from some blog. Note that Preferences will be under the Eclipse menu (not RadRails, the customized Eclipse version), and that the exact paths will be different based on what version of Locomotive you have (the release date is part of the path, ugh) and whether you are on an Intel-based Mac (select “i386” path) or a PowerMac (select “powerpc” path).

After following my instructions I was still getting weird errors in RadRails when trying to create a HelloWorld project. I think the key is to do the RadRails configuration before creating any projects. Remember that Eclipse configuration follows the workspace, so if you create a new Workspace for RoR work then make sure you do that before you configure RadRails to use the Locomotive paths.

TextMate looks unHackySensorable

I’m in the process of learning Ruby on Rails, and apparently the canonical editor for RoR on Mac OS X is TextMate. Philip asked me to look into adding HackStat sensors to TextMate so I could be sending sensor data to HackyStat as I do RoR hacking. It appears that TextMate, despite it’s extensive programmability, doesn’t provide the type of hooks that would be necessary to send DevTime sensor data to HackyStat.

In March 2006, the TextMate developer said he was going to be working on callbacks in a future version. In October 2006 the developer said that such callbacks were “not around the corner”

Depending on TextMate’s AppleScriptability, it might be possible to write a separate daemon that queries TextMate periodically for the sensor data. Still need to investigate that.