Home / Blog / Autotest Growl for Windows /

Autotest Growl for Windows

July 10th, 2009

In a previous blog post I detailed how to get Autotest Growl notifications on Windows using Snarl. But, there now exists an official Growl client for Windows.

So how about we update autotest-growl to support Windows (on top of it’s existing support for OSX).

If you don’t want to know all the gory details, you can just install my fork of the autotest-growl gem, that includes native Growl Windows support:

gem install karl-autotest-growl --source http://gems.github.com

Obviously, you’ll need to have Growl for Windows installed as well!

Updating Autotest Growl to support Windows

First up download and install Growl for Windows (if you haven’t already).

Updating Autotest Growl turns out to be pretty simple. We need to download growlnotify for Windows, and add it to the growl/ directory.

Then we can update the autotest-growl code to decide which growlnotify to use depending on the Operating System.

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  def self.is_windows?
    processor, platform, *rest = RUBY_PLATFORM.split("-")
    platform == 'mswin32'
  end
 
  ##
  # Display a message through Growl.
  def self.growl title, message, icon, priority=0, stick=""
    growl = File.join(GEM_PATH, 'growl', 'growlnotify')
    image = File.join(ENV['HOME'], '.autotest-growl', "#{icon}.png")
    image = File.join(GEM_PATH, 'img', "#{icon}.png") unless File.exists?(image)
 
    if is_windows?
      growl += '.com'
      cmd = "#{growl} #{message.inspect} /a:\"autotest\" /r:\"Autotest\" /n:\"Autotest\" /i:\"#{image}\" /p:#{priority} /t:\"#{title}\""
    else 
      if @@remote_notification
        cmd = "#{growl} -H localhost -n autotest --image '#{image}' -p #{priority} -m #{message.inspect} '#{title}' #{stick}"
      else
        cmd = "#{growl} -n autotest --image '#{image}' -p #{priority} -m #{message.inspect} '#{title}' #{stick}"
      end
    end
 
  system cmd
  end

You’ll notice that the command line flags are slightly different for the Windows version of growlnotify, the using the /x: format, rather than the OSX -x format.

The Windows version also adds the flat /r:"Autotest" to ensure the Autotest application is registered the first time it is run.

There is no need to deal with the @@remote_notification settings, as Growl for Windows does not have the same problem with intermittent notification loss that OSX does.

Installing updated Autotest Growl gem

I have rolled all these changes into my fork of autotest-growl. To switch over to this fork, open a Windows command prompt and enter:

gem uninstall autotest-growl
gem install karl-autotest-growl --source http://gems.github.com

And then watch the notifications roll in!

6 Responses to “Autotest Growl for Windows”

  1. New version of Autotest Growl (with Window support) – Blog - monket.net Says:

    [...] In a previous post I detailed changes I made to add Growl for Windows support to Autotest Growl. [...]

  2. Growl Becoming a Must-have App on Windows? Says:

    [...] Autotest – Get informed when your tests pass or fail. [...]

  3. Growl Becoming a Must-have App on Windows? | PC Software News Says:

    [...] Autotest – Get informed when your tests pass or fail. [...]

  4. Growl Becoming a Must-have App on Windows? | Computer Hardware Blog Says:

    [...] Autotest – Get informed when your tests pass or fail. [...]

  5. MTPH Software: Blog : Growl Becoming a Must-have App on Windows? : Says:

    [...] Autotest – Get informed when your tests pass or fail. [...]

  6. roger Says:

    submit upstream maybe?