ViewGem, a Little Script

Posted 2008-08-10…

I'm not one to rely on or whine about documentation for an open source library, especially when the library is written in Ruby.

I can read Ruby just fine, thank you very much. Well, most people's ruby.

What do you do when you need figure out what’s going on inside a gem, or just get a feel for its API?

I don’t use generated documentation to help me solve problems — often the library’s author and I disagree about what’s important to mention, and/or the documentation is fairly non-existent. Hey, I can’t whine… this stuff is free.

While I don’t necessarily agree with my esteemed colleague Adam Keys on his hypothesis that comments are a bad smell, I can definitely state that many smell bad. The fact they get generated into a prettier format also doesn’t help much… and well, we all know how often User’s Manuals and the like get updated.

Just get me to the code already!

Here’s a little script

For years I’ve kept a little commandline tool handy to pop open a gem in an editor; here’s the current incarnation. It opens the latest matching gem (usually this is all I care about), and supports a RubyGem version requirement. Feel free to use and modify as you wish!

Example:

$ viewgem rails -v '< 1.2.0'