This page describes how to install beta RadRails/Aptana on Eclipse 3.2 and 3.3.

Software Decisions

  • Aptana with RadRails is getting quite good as long as you use very recent milestone releases.
  • Eclipse 3.3 is much better than 3.2. It's worth a little extra installation effort.
  • Aptana doesn't provide an amd64 build. If you want to run native 64 bit, you need to assemble it yourself.
  • I find that subclipse integrates with svn better than subversive (storing passwords, less buggy, etc).
  • SQL Explorer is *much* better than the Data View that comes with RadRails. If you'd rather click at your database more, try Quantum. Feel free to install both and just use the one you like.
  • I'm using Ubuntu Feisty on AMD64 but these instructions should work on just about any recent Linux distro. I hope Macs are close too.

Installation

Follow these instructions to install the full Aptana/RadRails/RDT stack.

Install Rails

Most Linux distributions come with Rails packages. Don't use them! There are a number of oddball include problems that just go away if you use the gems directly.

 $ sudo apt-get install rubygems
 $ sudo gem install rails --include-dependencies

Also, I needed to explicitly install the MySql bindings.

 $ sudo apt-get install libmysql-ruby libmysql-java

Install Eclipse

First, make sure you have a decent Java installed. Running "java -version" should print "java version 1.6.0." or 1.5.0. If not, see this post. Even though many Linux distributions come with them pre-installed, Gnu gcj, Classpath, and Apache's Harmony do not work.

Most Linux distributions come with Eclipse pacakges pre-made. Don't use them! Eclipse currently gets very cranky if it can't write to all of its files. It's much easier just to install it into your home directory.

  1. Download a bare-bones Eclipse from here. (If RadRails still has that beta 7 bug, you'll need to use 3.2. Download it from the archives.)
  2. Extract it: $ tar zxvf eclipse-platform-3.3-linux-gtk-x86_64.tar.gz
  3. Launch it: $ eclipse/eclipse (the default workspace, /home/you/workspace, is fine for now)

UPDATE: Eclipse 3.3 64 bit on Sun JVM 1.6 will probably produce random crashes. This is basically a strange design flaw in Sun's JVM. You can work around it by adding this line to eclipse.ini:

 -XX:MaxPermSize=128m

UPDATE: Eclipse 3.2 might bail out complaining "/usr/bin/java: symbol lookup error: /home/bronson/Eclipse-3.2/configuration/org.eclipse.osgi/bundles/81/1/.cp/libswt-mozilla-gcc3-gtk-3236.so: undefined symbol: NS_InitEmbedding". No problem (thanks gleamynode). Just start Eclipse like this:

  MOZILLA_FIVE_HOME=/usr/lib/mozilla ./eclipse

UPDATE: That runs but it's not quite sufficient. I still get "org.eclipse.swt.SWTError: No more handles (java.lang.UnsatisfiedLinkError: no swt-mozilla-gtk-3236 in java.library.path)" errors. To fix this, save this script as "start" in the same directory as the eclipse executable, then "cd eclipse" and "./start". That fixes it for me. Thanks to Steve Mitchell.

 #!/bin/sh
 
 # Start Eclipse 3.2 so it can access Firefox's renderer.  Not needed for 3.3.
 MOZILLA_FIVE_HOME=/usr/lib/firefox/
 if [ $LD_LIBRARY_PATH ]; then
   LD_LIBRARY_PATH=$MOZILLA_FIVE_HOME:$LD_LIBRARY_PATH
 else
   LD_LIBRARY_PATH=$MOZILLA_FIVE_HOME
 fi
 export MOZILLA_FIVE_HOME LD_LIBRARY_PATH
 ./eclipse $*

Install Aptana

  1. Add the Aptana Update Site
  2. You will probably also want to install Subclipse
  3. Finally, you will probably also want to install SQL Explorer or QuantumDB. QuantumDB is more clickey, SQL Explorer is more typey. If you're not sure, install both and see which one you like.
  4. Click Finish. Tell Eclipse to auto-select the mirrors if it asks.
  5. Select all of the features to install. If you're installing QuantumDB, you'll want to hit "Select Required" to have it pull in the appropriate GEF pacakges.
  6. Hit Finish again, the plugins are downlaoded. Agree to the licenses, hit Install All, the plugins will be installed and then restart Eclipse.

Upgrade to Beta Aptana

Because of the silly way that Aptana updates itself, you need to do another song and dance if you want to run the beta packages. Generally I recommend the betas because they have fewer bugs and more features. But definitely check the forums first to make sure there are no showstoppers (like the RadRails M7 in Eclipse 3.3 kablooey).

For Aptana, go to Window -> Preferences -> Install/Update -> Aptana Automatic Updates and select the type of updates that you want.

And, for Rails, you will need to follow these directions. Basically, you put http://update.aptana.com/update/rails/beta/3.2/policy.xml into Window -> Preferences -> Install/Update -> Policy URL.

Now, restart again and you should be up to date.

Install RadRails

There have been significant improvements since the last RadRails beta so we'll tell Aptana to install the most recent milestone.

Now, close Eclipse's Welcome tab. You should see the Aptana Start Page (if not, Help -> Aptana Start Page). At the bottom of the Plugins view you should see "Aptana RadRails". Click on "install" and let Eclipse restart again.

Set Up QuantumDB

Quantum calls its stored connection info "Database Bookmarks." So, if you want to connect to a new database, you need to create a new bookmark.

  • Window -> Open Perspective -> Other -> QuantumDB
  • Right-click in Database Bookmarks and select New Bookmark

Add the JDBC Driver

  • Click Add Driver, click Add External Jar
  • Select /usr/share/java/mysql-connector-java.jar
  • Click Browse, select com.mysql.jdbc.Driver
  • Ensure Type is set to MySQL, click Finish

Create your Database Bookmark

  • Select MySQL, hit Next
  • Enter your authentication info. Unfortunately, Quantum requires you to enter a database name. You'll need to use another tool to create and drop databases.
  • Hit Next, name your connection, then hit Finish.

Now, when you double-click the database bookmark, QuantumDB will log in and allow you to click through everything.

Change Execute Now keypress

Quantum uses Control-Shift-Q to run the SQL. Almost every other tool in existence uses Control-Enter. No problem...

  • Window -> Preferences -> General -> Keys
  • Type "Execute SQL" into 'type filter text' and select it.
  • Hit Copy Command, select the new copy
  • Click on Binding, hit Control-Enter
  • Make sure that When is set to "Quantum UI Scope"
  • Click OK.

Now both Control-Shift-Q and Control-Enter execute the SQL.

Set Up SQL Explorer

First we need to tell SQL Explorer where to find the Java MySQL driver.

  • Window -> Preferences -> SQL Explorer -> JDBC Drivers
  • Select "MySQL Driver" and click Edit.
  • Click Extra Class Path, Add, and then find your Java MySQL driver. On my system it's it's in /usr/share/java/mysql-connector-java.jar
  • Click OK to close the Prefs dialog

Then we need to create the SQL Explorer connection.

  • Window -> Open Perspective -> SQL Explorer
  • Click the "Create New Connection Profile" button in the Connections view.
 Name: MySQL Root
 Driver: MySQL Driver
 URL: jdbc:mysql://localhost
 User Name: root
 Password: whatev
  • Click OK to close the prefs dialog.

And you're done. Start coding!

Using Aptana

TODO: add hints on how to use Aptana more effectively here.

You might find relevant information on my Eclipse page. Also see HoboIntro.

Using SQL Explorer

Use SQL Explorer to create the databases.

  • Double-click the new "MySQL Root" entry to connect.
  • Type "create database pod_development;" into the SQL Editor window and hit control-enter.
  • Do the same for pod_test if you want to run unit tests.

Debugging

Let's try out Aptana's debugger. It actually works quite well.

First, install the gem. You can try using the Gem view to do this (Window -> Show View -> Other, Ruby -> RubyGems) but I just get permissions errors when I try it. Apparently Aptana doesn't know how to ask for the root password. Oh well, that's what the command line is for.

 $ sudo gem install ruby-debug-ide

If Aptana bug 5663 isn't fixed yet, you'll have to make sure that there's a symbolic link to rdebug-ide in /usr/bin.

 $ sudo ln -s /var/lib/gems/1.8/bin/rdebug-ide /usr/bin

Now, go to Window -> Preferences, Ruby -> Debugger and check "Use ruby-debug".

You need to start your server in debug mode. Right-click the server, choose Edit, and set the Run Mode to Debug. (make sure you've made this change as mentioned above).

Start the server. Now set a breakpoint somewhere in your code (right click the bar on the left) and then run a query that causes that line to be executed. Everything should work just as you would expect.

To Organize

There's never a need for "debugger" commands in the code. Double-click the left hand ruler in the migration file on the line you want a breakpoint. Then go to the Rails Shell and enter "debug rake db:migrate". That should run rake under the IDE debugger (which uses ruby-debug). [1]