My Ruby on Rails Development Environment on Ubuntu.

July 31, 2007

The core Ruby on Rails development team uses TextMate, a MacOSX (only) programming text editor that is apparently the greatest thing ever. A quick Google search reveals countless blog and forum posts devoted to finding something with similar functionality on Linux and Windows.

I am starting to develop with Ruby on Rails on Ubuntu and three of the suggested alternatives looked attractive to me. If you are planning to develop exclusively in Ruby/Ruby on Rails and want the lightest weight solution that is probably closest to the TextMate experience, Gedit is a good alternative. But if you want a fuller experience, or if you develop in multiple languages, jEdit and Eclipse are (I would argue) the two best options.

jEdit is very lightweight, performing like a basic text editor such as Gedit. I also like how it integrates plugin management better than Eclipse. I used jEdit for a few years when I was doing significant work in Python and PHP (and used IDEA for Java development) and was always very happy with it.

In fact, I resisted using Eclipse, even when it was clear that it was gaining mindshare among developers because I thought IDEA was the best Java IDE and as a language neutral tool, I thought jEdit was much more mature. But ultimately, I wanted to follow the Pragmatic Programmers advice and use one tool for all of my work, and although jEdit fit the bill, it is first and foremost a programming text editor with IDE-like features added on through its plugins while Eclipse is a full IDE that better integrates the functionality of its language plugins with the core interface.

And for programming in multiple languages, Eclipse offers a feature that jEdit doesn’t: perspectives. In jEdit, your panes and tabs remain the same until you manually change them, but in Eclipse you can arrange panes and specify tabs that are appropriate for the language or task that you are performing, which is a very important feature for optimizing your editing environment quickly when switching tasks. So, I ultimately switched to Eclipse several years ago and do almost all of my development work inside of it.

For programming in Ruby in Eclipse, you only have to install one plugin, RadRails, to get the functionality (and more) that in jEdit requires you to install not only the Ruby plugin, but a handful of macros and snippet files to approximate TextMate’s functionality. RadRails is also actively developed and supported by a core group of developers while the jEdit macros and snippets listed below are offered by their various creators more as a starting point than as true projects that evolve over time.

Eclipse with RadRails not only offers the obvious support for things like syntax highlighting, class browsing and code completion, but it also has nicely integrated support for running Rails servers, generators and Rake tasks. It also has built in RDoc support as well as FTP/SFTP functionality. Eclipse itself integrates nicely with version control systems like CVS and SVN and can graphically run unit tests.

Some people (non-Java programmers) complain about the overhead of Eclipse, but I think this is grossly overstated. Obviously, Eclipse will have more overhead than something like Gedit, but once started, your user experience will be just as quick for almost every activity. Even on my bargain laptop (a Compaq Presario v3000Z AMD Mobile Sempron 3400+, 512Mb RAM, 40Gb hard drive), it runs well. Your mileage may vary under Windows, but then again, everything is bloated and slow under Windows, so you’re used to it. On Linux, you just have to be sure you are using Sun’s Java runtime and not the GNU runtime that is the default on Ubuntu, for example. If you really do experience problems, you can change the memory allocated to Eclipse in its launch script.

Finally, if you are new to Eclipse and are just looking for a Ruby/Ruby on Rails IDE, I would recommend that you download and install the Aptana IDE which is a pre-built version of Eclipse specifically for Web development, including Ruby on Rails development with SVN functionality. This will get you started more quickly and easily, especially as the current version of the RadRails plugin running on vanilla Eclipse is a little flaky. The Aptana IDE does not appear to have the same issues.

But for the sake of completeness, and because of my previous loyalties to jEdit, I decided to explore what it would take to turn jEdit into a good Rails editor. With only a little extra work, jEdit can become quite a productive Rails environment. Here are links to what is my best guess for the best/most up-to-date snippets and macros various people have proposed and improved upon over time.

I left off the Ruby Editor plugin for jEdit, as well as the SuperAbbrevs plugin, preferring instead just to select every plugin from the jEdit repository and install them through the built in plugin manager. You’ll end up using many of these plugins anyway, and its quicker to just download and install them all than to examine each and install them individually.

Here is the docking configuration that seemed to make the most sense, configured under Utilities –> Global Options –> jEdit –> Docking:

Docking

  • Left
    • File System Browser
    • Sidekick (structure browser)
  • Bottom
    • console
    • hypersearch results
    • ruby docs

My approach to docking was to streamline the interface and put things where they made the best use of space, very similar to how Eclipse panes are typically displayed. I also configured the following keyboard shortcuts to enable less mousing, where A is the alt key and C is the control key:

Shortcuts

  • Built-in Commands
    • File System Browser (toggle) [A-left]
  • Macros
    • open alternate file [A-a]
    • select superabbrevs [A-s] (or you might prefer [C-Space])
  • Plugins: Console
    • Console (toggle) [A-down]
  • Plugins: Ruby
    • Find Declaration [A-d]
    • Ruby docs (toggle) [F2]
    • Structure browser [A-b]

These are configured under Utilities –> Global Options –> jEdit –> Shortcuts.

For the shortcuts, I tried to use an approach that is both consistent and uses mnemonics to suggest what they do. So, everything is triggered by the Alt key and then “s” for superabbrevs, “b” for structure browser, etc. For Ruby docs, I wanted to bind this to the little used F1 or help key, which seemed to make sense. But currently, I use Tilda which binds to F1 by default, so assigning Ruby docs to F2 seemed like a good compromise.

I don’t necessarily recommend this for everyone. Keyboard shortcuts that make sense to one person with a certain background, may not make sense for another person with another background. But if you are just looking for a starting point, I think you could do worse. To further customize jEdit for Rails development, Google is your friend, and you will find more sites devoted to this topic than you will have time to read.

9 Comments »

2007-09-15 14:05:17

[...] a previous post, I went through my thought process for choosing Aptana/RadRails (on the Eclipse platform) as my [...]

 
Comment by Drew Merkle
2007-09-29 05:17:17

It’s a wonderful thing when someone such as yourself saves people time by providing an analysis such as this. Thank you very much.

Comment by admin
2007-09-29 08:55:54

Thanks for the comment, I’m glad you found this helpful. Also, you may want to look at my more recent Netbeans post (the link to which is in the first trackback above). I have been using Netbeans for several weeks now and am generally happier with it than RadRails.

 
 
Comment by Ruby on Rails
2007-12-06 11:01:45

LOL. Indeed TextMate is the best thing ever for developing on a Mac (for Ruby anyways). I mean and you have other options like TextEdit and others, but I just don’t know what the deal is with TextMate that makes it a lot better. I think is the coloring and the rendering of text. Anyways, test it and see.

Jenn

Comment by admin
2007-12-06 12:08:36

From what I’ve seen of TextMate, it does look impressive. Its creator obviously takes a lot of care with it. Unfortunately my work circumstances don’t provide me with a Mac at the moment (although I did develop on a Mac in the past, before my infatuation with RoR and before TextMate–I used jEdit then). If I start doing RoR development in the majority of my work, it would be tempting to purchase a Mac…

 
 
Comment by Adrian
2008-01-06 17:45:37

I think you should give Scribes a go. :)

Comment by admin
2008-01-10 18:21:33

I’ve used Scribes in the past and really like it for general text editing. I see a blog post (at http://bitsbam.com/?p=3) to add rhtml support to Scribes, but otherwise, I don’t get the sense that its a particularly strong RoR editor per se. Could you elaborate on your recommendation?

 
 
Comment by T1
2008-01-19 23:26:46

When we try to address the question if this can be used for product development, it certainly can be, and is ideally suited for database driven web-based products. Rails is ideally suited for those who want to quickly deploy their web-based products; low cost internal prototypes and pilot applications; highly targeted internal applications and utility programs; and web 2.0 applications. One can assume that the smaller the development team and more ambitious the project, the more likely you are to benefit from Rails. Very small projects probably does not require Rails and can do with CGI programs and PHP, but when there is a use of relational database with more than one table, you are likely to benefit from Rails.

 
Comment by acwolf
2008-08-08 19:02:13

Netbeans is a great Rails IDE as you can avoid a lot of server resets - for example when you make changes to the routing using netbeans you dont need to restart the server…saves bunches of time.
Lately though I’m into using dreamweaver with the rails plug in. It’s especially useful for production problems as you can quickly fix code locally and send the files to the server quickly - effectively using dreamweaver as a light weight version control. For single developer hobby rails apps (say like ThisLittleTown) I think dreamwaver makes things super simple. If it’s stupid and it works it aint stupid.

 
Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.