Originally posted at altentee.com by Tim Koopmans.
A quick poll on wtr-development indicated a number of different applications to achieve such a task, each having their own pros and cons. It really depends on what features appeal to you. My personal experience has led me to try a lot of different editors and development environments in the past including:
Editors
SciTE NotePad++ TextMate VIM Emacs (actually I haven’t used this one)
IDEs
RubyMine NetBeans
Pros and Cons for each (subject to personal opinion) are as follows. SciTE binaries (with Ruby specific syntax support) come packaged with older versions of the Ruby installer, particularly 1.8.6 variants favoured by Watir. It’s a simple text editor which supports Windows and Linux. I used it for a long time on Windows, even going so far as customising settings but lost some of its shine when I started to use platforms other than Windows … This editor is also free.
TextMate was “Created by a closet UNIX geek who was lured to the Mac platform by its ease of use and elegance, TextMate has been referred to as the culmination of Emacs and OS X and has resulted in countless requests for both a Windows and Linux port, but TextMate remains exclusive for the Mac, and that is how we like it”. This editor costs about €39.
This is the main reason (single platform) I stopped using this editor despite some of its awesome features and great support for Ruby. I find that I work on many different platforms so didn’t want to be bound to a single platform as is the case for TextMate. If this isn’t a consideration then you might want to check out the large number of bundles (plugins) available for TextMate that can assist you with Ruby and Watir friendly features such as:
- https://github.com/bmabey/cucumber-tmbundle
- https://github.com/dchelimsky/rspec-tmbundle
- https://github.com/mocoso/code-beautifier.tmbundle
Notepad++ is a nice free editor for Windows based on the Scintilla libraries also used by SciTE. I used this for a brief period and it has very similar features to say SciTE but I wouldn’t say this has specialised support for Ruby, but does support things you’d ordinarily expect such as syntax colouring, folding, auto completion and the like.
VIM or the gVim variants is my current editor of choice. I fell into this space with the desire to have a consistent editor regardless of the platform I operate from. VIM is very extensible and has a large range of scripts/plugins available to suit different needs. Plugins I particularly use for Ruby / Watir include:
- FuzzyFinder (for files/directories) http://www.vim.org/scripts/script.php?script_id=1984
- NerdTree (for a tree based explorer) http://www.vim.org/scripts/script.php?script_id=1658
- AutoClose http://www.vim.org/scripts/script.php?script_id=1849
- Comments http://www.vim.org/scripts/script.php?script_id=1528
- Endwise http://www.vim.org/scripts/script.php?script_id=2386
- Surround http://www.vim.org/scripts/script.php?script_id=1697
Another developer on wtr-development recommended the following additional plugins:
- command-t instead of fuzzyfinder https://wincent.com/products/command-t
- vim-matchit https://github.com/tsaleh/vim-matchit
- tabbar http://www.vim.org/scripts/script.php?script_id=1338
- repeat-vim http://www.vim.org/scripts/script.php?script_id=1338
The great thing about VIM is that the environment in which you work stays the same, no matter if you’re working on OSX, Linux or Windows. Some say it has a steep learning curve. I would say the major obstacle is first getting used to a command mode versus an editing mode. But once you get used to some of the basic shortcuts, plus a little finger/muscle memory, you will find the editor to be extremely powerful. As my VIM experience continues I tend to use less of the mouse, and more of the keyboard.
Another powerful editor in this space which I have not used, but comes highly recommended is EMACS. I imagine this editor has many of the same benefits / features as a tool like VIM. I can’t offer any tips though, never having used it.
Finally, if text editors or their variants don’t cut it, you may opt to use a fully Integrated Development Environment. Despite some users on wtr-development using NetBeans, due to discontinued support of Ruby in NetBeans 7 it is probably not worth recommending this as a viable option.
A more popular IDE for Ruby is RubyMine which currently offers a 50% discount for $29 USD. This apparently has excellent support for Ruby development and testing including things like Cucumber and the like. I don’t have any experience with it per se and generally don’t find I need the support of a full blown IDE for my Ruby / Watir related tasks (a pet hate being how long it takes to load up an IDE in the first place), so will have to trust the community feel on this. A number of wtr-development users strongly recommend it though.
YMMV.