Sha256: 86328d65f8d1fe2e656cc8e87519b36483dd8ce61c194fb00dd9bb28d1964a1d

Contents?: true

Size: 618 Bytes

Versions: 1

Compression:

Stored size: 618 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)
      register

      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.1 lib/notifier/growl.rb