August 2009 Archives

My developer toolchain for Ruby

| No Comments | No TrackBacks
I recently learned Ruby and I thought I'd lay out the different tools I use when programming Ruby just for self documentation purposes. Most weight is put on the IDE and the TDD tools that I use.

IDE

IDE is a big deal for many people and I have tried two, Eclipse and Emacs. Since I normally only program Ruby on Linux, these are my two alternatives. In Eclipse I've tried the ruby plugin from Aptana and the standard one in the "Programming languages" section of the eclipse update manager. and I can't say I prefer one over the other. Since Ruby is a dynamic language you won't get the benefit of refactoring and completion like you would in Java, and this has lead me to ditch Eclipse for Ruby in favor of Emacs. What I miss in Emacs is integrated docs and integrated test runner. It's possible in emacs as well but takes some hacking. We'll see if I get around to that. I've been using Emacs for 12 years or so, and the first tool you pick always stick. This is my current ruby setup for Emacs:
(autoload 'yaml-mode "yaml-mode" "" t)
(autoload 'ruby-mode "ruby-mode" "" t)
(autoload 'rhtml-mode "rhtml-mode" "" t)

(require 'flymake-ruby)
(add-hook 'ruby-mode-hook 'flymake-ruby-load)

(add-hook 'ruby-mode-hook
          (lambda()
            (add-hook 'local-write-file-hooks
                      '(lambda()
                         (save-excursion
                           (untabify (point-min) (point-max))
                           (delete-trailing-whitespace)
                           )))
            (set (make-local-variable 'indent-tabs-mode) 'nil)
            (set (make-local-variable 'tab-width) 2)
            ;;(imenu-add-to-menubar "IMENU")
            (local-unset-ket "TAB")
            ;;(define-key ruby-mode-map "TAB" 'yas/expand)
            (define-key ruby-mode-map "\C-m" 'newline-and-indent)
            (require 'ruby-electric)
            (ruby-electric-mode t)
            ))

;(add-hook 'ruby-mode-hook
;          '(lambda ()
;             (make-variable-buffer-local 'yas/trigger-key)
;             (setq yas/trigger-key [tab])))

(provide 'ruby)
I use flymake to do interactive compile as I type but I suspect I'll be turning this off when Ruby gets more into my fingers. I want to get irb up and running from within Emacs but haven't gotten that far yet. In addition to the ruby specific stuff I use ECB, auto-complete and yasnippet for extra support. In fact my complete emacs setup is available at the emacs github repository. I'm also thinking about getting some elisp together to be able to integrate the testrunner into a shell window in emacs. The shell part isn't hard but it takes some configuring to get the window electric and behaving the way I want.

TDD/BDD tools

I develop in a TDD/BDD style and most of the tools are geared towards that. Here's a list:
  • The ruby metric_fu for all your analysis and metric needs. It wraps a lot of other rubygems that are handy. It covers code coverage with rcov, cyclomatic complexity with Saikuro, Flay for duplication detection, Flog for misc. pain points, reek for code smells and more. Nice graphs and all.
  • Cucumber for BDD style outside-in testing. Does a great job both for web applications and non-web applications.
  • Test::Unit for low-level unit test for driving out the details of classes.
  • RSpec for the times when the Test::Unit assertions feels awkward.
  • Github for storing everything. Git is the coolest version control system since, well, since ever.
Generally things move so damn fast in the ruby space and it's hard to keep up when it's not your main activity.

What's next

I haven't tried Ruby-on-Rails yet and the next webapp idea I get, I'm seriously considering doing that. Yeah, I know. I'm slow.

All your APIs are belong to us

| No Comments | No TrackBacks
I saw the link to gotapi.com link referenced from stackoverflow question 63918 and if you're like me and program in multiple languages and multiple frameworks it is the closest thing I've found to a one stop website for API references. It acts as a wrapper around API docs and specs from all over the web and covers things like Java API, JQuery (albeit an older version), Python, PHP, GWT, Ruby (and Rails), HTML, CSS XSL/XPATH/XSD, Perl and much more. And to top it off, you can cherrypick which ones to search in at start.gotapi.com. This replaces a lot of bookmarks for me.

Luke - the Lucene index viewer

| No Comments | No TrackBacks
I'm working on a web application at the moment which uses Lucene as a search engine and the <a href="http://framework.zend.com/manual/en/zend.search.lucene.html">Zend Lucene PHP port</a>. And when debugging the indexing of documents I came across <a href="http://www.getopt.org/luke/">Luke</a> a browser for the Lucene index file format. It's a nifty tool and really the swiss army chainsaw you need when you can't really search for what you thought you added or thought you added something that isn't really searchable at all. It is written in Java and uses the java Lucene libraries but reads the Zend Lucene index file without problems (They're compatible after all). It lets you view fields in the index and all sorts of information about them and browse all documents stored in the index and of course search it to actually see what you get. A very cool tool when it comes to debugging Lucene.

mini bio

Knut Haugen [Knu:t Hæugen], Norwegian software developer with a penchant for dynamic languages and anything to with developer testing. Agile methodology geek with bias on Lean and Kanban. Some pointers to other stuff by me

meta

This page is an archive of entries from August 2009 listed from newest to oldest.

July 2009 is the previous archive.

September 2009 is the next archive.

Find recent content on the main index or look in the archives to find all content.