[ANN] Rake Test Output Prettifier

Watching the test results scroll by, it occurred to me that there must
be an easier way than either letting it go or capturing it to a log file
to mess with in TextMate.

Here’s my first stab at an HTMLifier for test output. Just download,
unzip, chmod +x, and you can:

rake | ./prake.rb

Which, if you are on a Mac, should bring up a Safari window with a
summary of the problems at the top linked to the details below.

Download from my humble website:

http://www.calicowebdev.com

Comments appreciated.

Steve

On Sun, Dec 18, 2005, Steve R. wrote:

Which, if you are on a Mac, should bring up a Safari window with a
summary of the problems at the top linked to the details below.

That’s pretty neat :slight_smile:

If you remove the path to Safari from the open command (ie, open %s
instead), it should open with the default web browser.

I believe that will make it also work in Linux. At least that section
of it. I did not look closely at the rest of the code for OS-specifics.

Ben

On Sun, Dec 18, 2005 at 09:41:39PM +0100, Steve R. wrote:

summary of the problems at the top linked to the details below.

Download from my humble website:

http://www.calicowebdev.com

Comments appreciated.

Here are a few comments:

If you find yourself using backslashes within double quoted strings to
escape
embedded double quotes, replace the surrounding double quotes with %()
delimiters.

“<a href="example.org">example”

%(example)

You a number of different characters other than () as the delimiter if
you
wish.

START_BROWSER_COMMAND = “open /Applications/Safari.app %s”

The open command takes a ‘-a’ option which allows you to specify which
application to use. So the above constant could be ‘open -a Safari %s’.

if l.rstrip.length == 0

This can be more directly expressed as ‘l.rstrip.empty?’.

You can bind this functionality to some key combo in textmate and have
it
open up its own window (in other words, skipping the Safari step).

More info here:
http://macromates.com/blog/archives/2005/09/28/html-output-for-commands/

I’d give a bit of padding in the boxes that hold the test results.

Thanks for sharing!

marcel