Sha256: cb6b987070965516aaf5c6a70086e66e6fbc85f7bf13aad02f55bebe316063dc

Contents?: true

Size: 961 Bytes

Versions: 2

Compression:

Stored size: 961 Bytes

Contents

module Notifiers
  class Growl < Notifiers::Base
    def self.installed?
      darwin? and command?('growlnotify')
    end

    def image(icon)
      @image = icon
      self
    end

    def priority(number)
      @priority = number
      self
    end

    def host(hostname)
      @host = hostname
      self
    end

    def password(secret)
      @password = secret
      self
    end

    def auth(authentication)
      @auth = authentication
      self
    end

    def to_s
      command = 'growlnotify'
      command << " --title '#{@title}'" if @title
      command << " --message '#{@message}'"
      [:image, :priority, :host, :password, :auth].each do |option|
        variable = instance_variable_get("@#{option}")
        command << " --#{option} #{variable}" if variable
      end
      command
    end

    def install_instructions
      'The Growl is not installed. You can find more details here: http://growl.info/downloads'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
notifiers-1.2.2 lib/notifiers/growl.rb
notifiers-1.2.1 lib/notifiers/growl.rb