Tag: shellshadow

ruby debugging with Aptana

Posted by on April 7, 2008

I’m pleased to report that Aptana Studio v1.1 ruby debugging works very well with merb and datamapper.

Last October, I tried every ruby debugger I could find (except the windows-only Sapphire Steele). At that time, only NetBeans 6 beta had any form of working debugger and for the most part, the command line ruby-debug was a better choice.

We were re-writing ShellShadow in merb (the old site was Rails).
Now that I’m exploring merb and datamapper and sequel, I find I need a GUI debugger. Unless you have an internalized mental model of the framework (e.g. you’re the creator), you won’t get far fast enough with command line debugging.
Aptana’s latest release on what was RadRails does the job.

Here are a few things to get you going:

  1. Download and install Aptana. This is a multi-step process where you need to install Aptana and then from the intro page, install the RadRails plugin. There may be updates to Aptana. Just let eclipse work its magic and update to the latest patches.
  2. install ruby-debug-ide.
    gem install ruby-debug-ide. You will want to run this as “sudo gem install ruby-debug-ide” if you are installing to your global gems setup.
  3. On OS X 10.5, I needed to create a link (the following is a one line command)
    sudo ln -s /usr/bin/rdebug-ide /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/rdebug-ide
  4. Config the ruby debugger in Aptana. Open the eclipse/aptana preferences dialog from “Windows->Preferences…”. In the section “Ruby>Debugger”, turn on the checkbox “Use ruby-debug library.
  5. Setup your app. I didn’t create a Rails project. I create a ruby project (its for merb). I have my aptana/eclipse workspace outside of my ruby project and simply point the working directory of my project to the right place. You’ll want to set your debug setting for this project to run /usr/bin/merb or whatever your app is. This approach litters my merb project directory with two files: .loadpath and .project. You’ll probably want to tell your version control system of choice to ignore these files.

Its not perfect, but this seems to be as good as it gets at the moment for a GUI ruby debugger. Here are a few things of interest:

  1. Breakpoint removal is flaky. We found that sometimes when you turn off a breakpoint, it doesn’t go away. We had to edit the code to force aptana/eclipse to refresh itself.
  2. Interactive console isn’t great. IRB has a cleaner expereince but the apatana console does work.
  3. Missing ability to eval expressions in the debugger. This would be a great feature and hopefully it gets added someday.

Many thanks to the Aptana RadRails team!!