Tooling for Rails Development

I am very particular when it comes to the tools I use for software development. When doing .NET development, I do not use only Visual Studio; I use both CodeRush *and* Resharper, plus some other plug-ins, as well as tweaking VS a lot to bend it to my liking (color scheme, fonts, custom keyboard shortcuts, different window layouts based on single or dual monitor setups, etc.), besides having finally embraced PowerShell to run a couple of things, as opposed to waiting on Visual Studio to become “not busy”.

When I started messing with Ruby on Rails I decided to spend some time (ended up being two weeks) with no tools other than Notepad2 and PowerShell. I wanted feel the pain first, figure out what I missed from my regular .NET development environment, and then figure out what was available for Rails development.

Some of my buddies swear by Vim, which I know I’m going to like when I get to it, but I figured this wasn’t the time to look into it yet, as I was already too busy learning lots of other stuff, so I didn’t want to get stuck at every other keystroke.

Since a couple of people suggested RubyMine, I decided to give it a go; the same company makes Resharper, so I guessed it’d be the easiest choice for me. The guess was right, at least so far.

Getting used to RubyMine

I started off just by using it to open multiple files and work with them. In small steps, I started to learn a few things and configure the environment to my liking. As much as possible, I’m setting it up with the same keyboard shortcuts I have in VS for certain actions that I perform a lot (for instance, looking up files, classes, etc.).

Once in a while, I visit the training material for RubyMine: there’s the Quick Start, there are videos, there’s the default keymap binding (which I have a quick link to on my desktop!). Another nice way to learn RubyMine is by using the Productivity Guide (available in the Help menu):

ProdGuide 

The Productivity Guide lists features and how often I’ve used them. I then look for the ones I’ve never used, see what they’re used for and how they’re accessed (at the lower half of the screen), and then give it a shot.

The Key Promoter plug-in is also a neat way to learn RubyMine. After you do the same thing with the mouse for 3 times (this is configurable), the plug-in shows a title tooltip to tell you what keyboard shortcut you can use to execute that action.

Organizing the IDE based on tasks

This is a feature I started using recently and am enjoying: say I’m working on a given task (implement user story X), and I have several files open. Then, for whatever reason, I need to switch gears to work on a different task (fix bug related to Y), which will require me to open an entire different set of files. By creating “tasks” in RubyMine, I can easily adjust my workspace based on the files I need to work on for each task.

task

Integration with Git / Mercurial

RubyMine integrates very well with both Git and Mercurial for version source control. For the most part I use the command line for committing, pulling, and pushing changes, but there are quite a few occasions when I rather have some visual way to invoke commands and see results (such as when comparing changes, or seeing history).

It also does some nice things, such as when I add a new file to a project, it asks me whether I want to version it or not.

I haven’t fully explored this integration, mostly because I’m relatively new to Git/Mercurial, but I do like what I’ve seen so far.

Navigating through files

All the common options for navigating through files are there, such as “go to class” and “go to file”. A Resharper feature that I use a lot in Visual Studio is “Find in Solution Explorer” (Shift+Alt+L). What that does is to put the keyboard cursor in the file as it’s located in the Solution Explorer. I use that *all the time*! It allows me to quickly go to the same place where the current file is located, and then go to files in the same folder, or other folders in the surrounding area.

In RubyMine, I can use the “Show Navigation Bar” option (Alt+Home):

navigation[8]

railsprojectI like that even better, as it allows me to easily navigate through the project’s structure, without having to go through a project treeview (which means I can always have the project window hidden, and therefore get more real state on my screen).

Another way to navigate through a Rails application is by changing the Project window to “View as Rails”, which then allows easy navigation through controllers, actions, and views.

 

 

 

 

Running Rake Tasks

rakeRunning Rake tasks is another thing I normally do through the command line, but RubyMine has an option to run the tasks within its IDE. 

The output of tasks go to the “Run” window in RubyMine. There are special visualizations for the output of things such as Cucumber tests. The one I use the most, however, is Rake Routes, since I can hit Ctrl+F and search for something within my routes:

routes

Working with Cucumber

RubyMine has nice features to work with Cucumber. Besides the already mentioned Cucumber test runner, it also allows from a step to its implementation by hitting Ctrl+B. And when defining scenarios, it also shows a list of available steps to re-use.

cucumber

Compare with clipboard

This one I’ve learned just a few days ago: besides invoking a “compare” between different versions of a file, RubyMine also has a “Compare with Clipboard” feature. It comes I handy when I have two blocks of code that seem to look similar but I can’t quite put my finger on what the differences are. With this feature, I can put one of the code snippets in the clipboard, go to the other one, and invoke “Compare with Clipboard”:

comparewithclipboard

Seems a lot faster than Visual Studio

As far as loading the first instance, it seems like the load times between RubyMine and Visual Studio are very similar. However, normal usage feels a lot faster in RubyMine. Also, once one instance of RubyMine is open, opening a second project in a separate window is almost immediate, which I can’t say the same thing about VS (it takes just as long to load a second instance of VS).

Console2

When doing Rails development, it’s convenient to have multiple command prompts open at the same time. I’m using Console2 for that, as it has tab support. I also like how you can set it up to load different types of console, such as PowerShell, git-bash, etc. I’ve configured mine so I have shortcuts to open the different types of console I use, as well as alternating between the tabs quickly.

I usually have at least four tabs open:

  1. Mongodb server
  2. Rails Server
  3. Rails Console
  4. My regular console for running Rake and other commands on the project I’m working on

console2

Summing up

I’m very happy with the tooling I have at hand at this point. I can’t really say, right now, that I’m missing anything from my .NET development environment. Quite the contrary, actually; not having to cope with the lockups of VS, the non-sense behavior of TFS, the testing-hostile tools and frameworks, has been a blessing.

Oh, and by the way, I’m doing development on Windows, since I don’t own a Mac. I’ve set up an Ubuntu virtual machine, but I don’t know much Linux yet, so I’m saving that for a later moment.

  1. #1 by martinkaden on January 28, 2012 - 1:18 am

    I have read this and i got it useful and helpful for me. This is a nice and important post for ROR . thanks a lot to share this idea with us

  1. How Can a .NET Developer Get Started on Ruby or Rails? » RubySource

Leave a comment