Autotest notifications in KDE using DCOP and KNotify

I recently came across a killer ruby application called autotest, which is part of a package called Zentest.
Geoffrey Grosenbach’s Nuby on Rails blog explains how to use autotest with Rails. It’s pretty simple, install Zentest:
gem install ZenTest
and from the Rails project’s root, type:
autotest -rails
Monitoring a console for failed tests is annoying and keeping an open console on-screen is too screen real-estate expensive on a 14 inch laptop. Enter KNotify and DCOP.
Create a file called .autotest in your home directory and paste the following code into it:
1 2 3 4 5 6 7 8 9 10 | #!/usr/bin/ruby module KDENotify def self.knotify title, msg system "dcop knotify default notify " + "eventname \'#{title}\' \'#{msg}\' '' '' 16 2" end Autotest.add_hook :red do |at| knotify "Tests failed", "#{at.files_to_test.size} tests failed" end end |
Once autotest is started and coding has commenced, a passive pop-up window will appear as soon as a saved file has caused a test to fail.
This is all made possible by autotest’s excellent design along with the genius that is KDE.
August 25th, 2006 at 2:42 pm
Thanks - very useful
August 29th, 2006 at 8:49 pm
may I steal that?
August 30th, 2006 at 12:01 pm
zenspider: sure you can! If you post the code in a blog, a referring link over to this one here wouldn’t go amiss
August 23rd, 2007 at 2:54 pm
[…] post info By geekvicious Categories: ruby, linux and programming Being a big KDE fan I was glad when the people at snailbyte came up with KDE desktop notifier for autotest. Even though KDE is by far my favorite desktop environment, knofity has a big drawback; it is not possible to choose the color, for the notifications. So based in the growl autotest notifier, I wrote a version for osdsh an X OSD manager, it is not as pretty as growl ;)… but it gives me colorized on desktop notifications on linux. […]
January 23rd, 2008 at 9:17 pm
Works perfect. Thank you.
February 10th, 2008 at 11:23 pm
Fail Loudly with osd_cat and autotest…
A key to Test Driven Development is frequently run tests. These tests are used to judge the health of a project. Like in a hospital, when things deteriorate we have to be alerted right away.
Ruby developers use autotest to monitor and run their test…
March 4th, 2008 at 3:14 pm
I pasted this code to .autotest file nad nothing happens while I’m saving files (test fails, but I can see this only from console). Could somebody tell me, what can be wrong?
July 26th, 2008 at 5:50 pm
[…] Notifications unter OS X ausgerufen wurden. Später stieß ich zufällig auf einen interessanten Blog-Beitrag, wie solche Meldungen unter KDE erzeugt werden können. Ich setze GNOME als Arbeitsumgebung ein und habe mir ein ähnliches Skript […]