Sha256: b345f37efb7fbe26f1063d581f3e1bbe508cb690b35c53da59f61b831bfbb770

Contents?: true

Size: 605 Bytes

Versions: 1

Compression:

Stored size: 605 Bytes

Contents

module Notifier
  module Growl
    extend self

    SCRIPT = File.dirname(__FILE__) + "/../../../resources/register-growl.scpt"
    FILE = File.expand_path("~/.test_notifier-growl")

    def supported?
      RUBY_PLATFORM =~ /darwin/ && `ps -Al | grep GrowlHelper` && `which growlnotify` && $? == 0
    end

    def notify(options)
      Thread.new do
        `growlnotify -n test_notifier --image #{options[:image]} -p 2 -m '#{options[:message]}' -t '#{options[:title]}'`
      end
    end

    def register
      return if File.file?(FILE)
      system "osascript #{SCRIPT} > #{FILE}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
notifier-0.1.0 lib/notifier/growl.rb