1. Introducing gruff

Geoffrey Grosenbach has one of the most familiar voices in the Ruby community. As host of the Ruby on Rails podcast, he’s introduced many of us to the key developers and contributors to Ruby and Rails. Lately he’s also been out on the road with Carson Workshops presenting one-day training sessions on Rails. London, New York, San Francisco,... what venues could be better?

Gruff is a free utility that Geoffrey has developed and made available on RubyForge. It is a Ruby library for generating many different kinds of two-dimensional graphs, including area, bar, line, pie, and several other more exotic varieties. Gruff isn’t a tool for “heavy lifting” or drawing large data sets, but it’s got an easy-to-use ruby interface and is great for quick visualizations… and the results look good, too.

Gruff generates images with RMagick, a Ruby wrapper around a cross-platform graphics library called ImageMagick... or GraphicsMagick, if you prefer a forked version. But that’s just the beginning of the confusion. I’m not saying it’s hard to install, only that you have to think a lot to do it. Tim Hunter, the developer of RMagick, has posted some thorough installation instructions on RubyForge... where he warns that you’ll need “at least an hour of free time.”

That’s a lot of effort for us rubyists, who agree with Larry Wall that laziness is a virtue. Mac developers also find it frustrating, because we know that Apple has provided plenty of drawing capabilities in Cocoa and Quartz. Fortunately, RubyCocoa can help us get to some of that.

A few weeks ago I watched Geoffrey present gruff at Canada on Rails in Vancouver. As he spoke, I kept wondering how hard it would be to use RubyCocoa to replace RMagick in gruff. Late last week I decided to give it a try; after a day of hacking, here are the results.

Did you find an error? Is something missing? Post your comment or suggestion below!

Comments (0) post