Saturday, November 13, 2010

IntelliJ Ruby Plugin

As I promised... more stuff on Ruby! This is about the installation.
OS X and Linux mostly have Ruby installed. However, you may want to install JRuby as well. On windows, I installed them both.

As a development environment, I choose IntelliJ, which I already use profitably for Java. Probably there are better choices (TextMate on OS X springs to mind, gvim/emacs). However, I want to see what can a "traditional IDE" (and a good one) offer for developing with a very dynamic language like Ruby. Unfortunately Python support does not seem as mature (besides, Ruby plugin is supported by IntelliJ developers and they also offer a Ruby IDE -- whose features should be offered by the Ruby plugin as well --).

As a side note, for Python I already bought WingIDE and I'm happy with that. However, since I don't plan to work with Ruby anytime soon, I only consider free (as free f*ckin' beer) solutions.





Here some screenshots from the setup of a Ruby project

So here some stuff on what the plugin can do. It's lots of interesting stuff.

However, I would like to point out that Ruby is a dynamic language; and the first things you are going to do are simple scripts to automate some repetitive task unless you are going to do Rails development. Since I'm not interested in Rails, I just point out that setting up a Rails environment seems very easy and well supported.

On the other hand I'm mostly interested in the "scripting" part, as it's the first you are going to meet if you don't do rails, like I said.

IRB is well supported. But I don't think its integration with the IDE is sufficient. I can open an IRB console and put Ruby commands inside. Good. A REPL is a very important part of dynamic languages development. I can also load a Ruby script directly in IRB (alt-shift-l -- btw, I suppose it will be a PITA on OS X).

However, since that command only 'requires' the file in IRB, successive invocations have no effect, unless you close and reopen IRB. It would be nice if modified versions of the script could be run without closing and opening IRB. It is something I would expect from a Ruby IDE. E.g., in TextMate it is very easy to do; and at the beginning it is just what you need.

The other options is creating a "runner". Which is easy, there is a menu entry that automagically creates one. This is good to run a script (but remember... you already created a project, and then create runners for every -- logically unrelated -- script in the project). This is a lot of useless work.

Things work slightly better if you just select the text and load (the selected text) in IRB. This way you can run the code more than once. Moreover, you can also have functions defined in IRB and than play with them. I think this is far more useful than 'requiring' stuff, especially because you can't reload.

Ok... the nice things another day. Maybe. However, the "environment" support seems really javish. Not happy. :(


4 comments:

Alfredo said...

May I suggest "RubyMine IDE" always from jetbrains?
You can have it for free if you can demostrate that you are involved or part of some university
I've coerced my thesis-relator to send a mail for a serial key last year :D
Very good editor :)

Unknown said...

Should definitely try. I can also prove that I'm with the university without my supervisor intervention...

E.g., http://www.dii.unipr.it/dii/portal/AreeDipart/Area2/persone/PersonPage.psml?idPerson=112

Could you please give me a link where they state that being involved with an university gives you free RubyMine?

Besides, as far as the guy at jetbrains say, RubyMine and the Ruby plugin for intellij have mostly the same functions. I believe that being project based is good for rails development (which is project based by its own nature).

However, I think it sucks for other stuff.

Alfredo said...

Take a look here:

http://www.jetbrains.com/ruby/buy/buy.jsp#classroom_

:)

Unknown said...

Technically that is a different thing. They say that they give you a free copy to use for educational and teaching purposes.

I'm not sure that just being with an University qualifies...

Besides, the point is not the money. It is that it is a language I'm not planning to use professionally any time soon.