Rolling on Rails with NetBeans IDE 6

Okay, long time no see (write/read). So, I'm back with good and bad news (good and bad for me, at least).

UPDATE: I was not aware that NetBeans IDE was originally developed by Sun Microsystems (which is actually quite logical if you look at NetBeans home page...).

UPDATE: Came accross a nice overview of NetBeans Ruby features on InfoQ.

UPDATE: Arch Linux users can take advantage of NetBeans availability through Community repository.

My coding partner and I decided to switch away from PHP and to Ruby on Rails. It has been a while since I've even touched Rails, and last time I coded in Rails, it was just for fun, nothing serious. So now, in middle of our production cycle, we decide to switch the entire platform. Yes, we are crazy, I know. And it will probably cost us a LOT. But that's merely a short-term effect. Rails coding is both fun and fast. But the latter characteristic is why we decided to do it. Plus the fact that our way of thinking naturally shifted towards object-oriented designs which was a pain in PHP.

As there is very little about Rails that is tedious, I didn't consider getting an IDE when I was starting. But now that I've forgotten most about Rails that I knew, I felt (hoped) that a good IDE would make things faster at least in the beginning. So I gave RadRails another spin, and it was okay. Hm, it was actually quite good. But due to Arch's rolling release system, RadRais was sort of broken, so I started looking for a solution which was less depended on what's present on the host. And I found a perfect fit.

Enter NetBeans IDE 6. When I first saw articles about it, I thought it was a commercial app. I mean, who would expect such a mature and grand player in the open-source world?! Guess I've been sleeping in my cave for a long time. The open-source is definitely capable of delivering quality software. Shame on me for doubting!

I won't provide screenshots of NetBeans here. Nope. I know when I first saw some of them, I thought it was a bit ugly and prefered RadRails' looks over it. However, behind this superficially ugly guise lurks one of the best things that happened to me after Arch Linux and Inkscape. So, let me get started.

Installation

NetBeans is as simple as it gets when it comes to installing. No, there is no prepackaged version for Arch Linux. But there is also no compiling to do either. Yes, it is an Java app, but it also has its own installer. The installer would in my case install the Ruby on Rails version of NetBeans IDE into my home directory along with jRuby (Java implementation of Ruby), and would also handle installation of Ruby Gems, and everything else I need to get started. It has its own update system and its own plugin installed which unlike previous versions of Eclipse does not require access to protected areas of the filesystem. In other words, once installed, it will be capable of supporting itself, and backing up the whole package is a matter of burning ~/netbeans-6.0 to a CD.

Integration with native Ruby installation

Of course, I wanted my NetBeans install to be a bit more complicated than what I said above. So I decided to make it use the native Ruby interpreter. Since native Ruby Gems update system uses a protected folder, NetBeans would no longer be able to maintain gems for me.

Solving this issue was also deceptively easy. I just had to add this line to .bashrc:

export GEM_HOME=/home/$MY_HOME_DIR/.rubygems

Just replace $MY_HOME_DIR with whatever your home directory is called. Now all gems would be installed to ~.rubygems. After restarting NetBeans it was more than glad to install some gems into that.

Some goodies

NetBeans supports the full range of Rails and Rake maintenance tools, and it can do pretty much everything you'd do from command line. One thing I noticed was the inability to migrate databases to a specific version. Some people might not like that, but I pretty much don't mind because I simply drop the whole database and migrate from version 0.

The way to do this manually is:

rake migrate VERSION=$YOUR_VERSION

NetBeans also supports TextMate-like code templates. For those of you who don't know, they are very neat productivity boosters that expand minute fragments of text into full code blocks. For example, I can type 'mtab' and hit [TAB] key and NetBeans would turn that into:

create_table :table do |t|

end

and place the cursor right there after the colon where it says 'table'. This saves a LOT of time when you have to create more than 20 of tables. Imagine not having to type any of the above, just 'mtab'. Neat, huh? :)

The templates are fully extensible and customizable, so I've used the opportunity to add a few of my own templates. It's quite easy. The new Rails 2.0 way of declaring table columns was not implemented in NetBeans IDE 6.0 so I created my own templates, in about two and a half minutes including the time to find out how the templates are written.

Among the downloadable plugins for NetBeans, there is a Collaboration plugin which allows two or more NetBeans users to chat over the Internet. The protocol used is XMPP (what else!). But chatting is not the only thing you can do with Collab plugin. You can actually share projects and files. You are probably thinking I just toss tarballs of my project folders over the Net, right? Nope, no such thing. I drag my project to the share box within the Collab interface, and my partner and I can actually type code into shared files, and both of us would see the results in (almost) realtime. It's like tuning into someone's editor and typing your code there, or having someone else do the same to you. It's quite impressive!

Extended Ruby and Rails hints are another great feature. It gives you small pieces of advice as you type away. You can, of course, add your own hints, although I doubt people needing those hints would actually write them themselves...

Second impression

So, I have this NetBeans thing on my Arch box for about three days now. I'm now completely used to it, although I can feel a lot of its power is still wasted here because I'm not yet intimate with how it works. However, I can tell you it took me a lot less to get used to it compared to Eclipse, for example.

If you've been wondering which IDE to use, take my advice and give NetBeans a spin. You will NOT regret it (unless you are on MacOSX, which would probably make TextMate a better choice).

I forgot to mention...

I forgot to mention that NetBeans supports PHP, HTML, CSS, XML, Java, C/C++ and a lot of other markups, languages, and whatnot. Of course, Java has by far the most complete support, and Ruby on Rails is close. I don't know about other languages, but its plugin list is pretty extensive.

The CSS editor is very neat and looks much like the CSS editor in Dreamweaver. It also has a Preview panel for realtime previews.

Eyedeal

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.

Powered by Drupal - Design by artinet