Tuesday, May 20, 2008

Getting started with Ruby on Rails development on Linux and the perfect IDE

Recently, I forayed into the cool world of RoR and my immediate question was, how to get started and which is the best IDE to start my RoR journey with. I found loads of options and I have decided to list them here for the benefit of others, who face the same problem. I will also detail the installation of the IDE that I am currently using, which I feel is the easiest for newbies to start with.

Installing RoR is downright easy. You first need.. Ruby, which comes readily built in with most of the linux distros. After that you need to get the Rails package which can be either be downloaded from the Ruby on Rails website or from your favorite package manager - apt, Synaptic, yum etc. Just search for Ruby and Rails, and install all the packages.For instance,

$ sudo apt-get install ruby
$ sudo apt-get install rails

Great! Once you have the packages installed, you can set up your first project as follows
$ rails myTestApp

To get your server running to test your stuff, simply run WEBrick server as follows
$ cd myTestApp
$ ./script/server

Great, with the RoR environment set up, you can browse the loads of resource available online to start developing in this framework. There are some really cool screencasts at the RoR website to get you started.

Now the next big question. Which is the best IDE to use?
All the screencasts, tutorials and books I have read, use textmate as their primary editor. Textmate is only available for Mac OS but there are some nice alternatives for Linux.

1. Vi:
Biodegradable Geek has a really nice post about Rails.Vim, a Rails plugin for Vim. I am not a huge fan of Vi but I know a whole lot of folks are.

2. Gedit:
With some nice 3rd party plugins, Gedit can be used as a really powerful editor for Rails. Read here for Textmate-like Gedit in few steps.

3.Aptana/Eclipse with RadRails:
RadRails is an open source IDE for the Ruby on Rails framework that runs on top of eclipse. Easily the most powerful IDE available for Rails development on Linux but it can be a resource hog at times and not recommended for the casual developers.

4. NetBeans IDE 6.1:
The latest version boasts of a really neat integration of RoR. Like eclipse, it does take up a lot of memory resource.

5. Kate:
My favorite editor by far when it comes to C/C++/Java development back in days when I had programming projects in the varsity. I really like the way the console is integrated into Kate.Kate supports syntax highlighting for ruby, rhtml etc.

6. Other Notable mentions:
JEdit, SciTe, FreeRide, NEdit and Bluefish. Click here for the full list

7. My Pick! - Komodo Edit:
Komodo edit is an open source code editor based on the commercial Komodo IDE. It's an excellent alternative for Textmate and includes the project drawer, and (some) auto completion.
As promised, let's see how to get it installed on linux.

1. Download Komodo Edit from the ActiveState website.

2. Extract the package
$ tar xvf Komodo-Edit-4.3.2-1263-linux-libcpp6-x86.tar.gz

3.Install Komodo Edit ( I installed it in /usr/local)
$ cd Komodo-Edit-4.3.2-1263-linux-libcpp6-x86/
$ sudo ./install.sh

4. Create a soft link in /usr/local/bin
$ sudo ln -s "/usr/local/Komodo/bin/komodo" /usr/local/bin/komodo

5. Finally, run Komodo
$ komodo

Well, there are plenty of choices available but the selection of the best IDE rests at the user's familiarity and preference to a certain environment. Hope this article helps you get started with RoR development on Linux. Have fun coding!!


Rhea said...

Great article man..
We MacBook users have the luxury of using the lovely textmate. We can just bypass all this effort ;)

Anonymous said...

Good to hear that you like Komodo. There's a screencast on the Rails tools
in Komodo at http://community.activestate.com/ruby-rails-2-support-komodo-4-3-part-1

Anoj said...

Thanks for the info Eric. Really appreciate the efforts put into Komodo Edit.

Dilip said...

my boss has give me and option of of using rails instead of PHP :D.. surprised


Anoj said...

lol u mean your hyp thesis supervisor Martin Henz.. or your boss at Barclays ;)
Anyways, i hope twitter solves its scalability issues with RoR..