Class: Duplicati::Notification::Growl

Inherits:
Base
  • Object
show all
Defined in:
lib/duplicati/notification/growl.rb

Instance Method Summary collapse

Methods inherited from Base

#load_gem

Instance Method Details

#notify(success) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/duplicati/notification/growl.rb', line 4

def notify(success)
  return unless load_gem "ruby_gntp"

  growl = GNTP.new("Backup")
  growl.register(:notifications => [{
    :name     => "backup-notify",
    :enabled  => true,
  }])

  growl.notify(
    :name  => "backup-notify",
    :title => "Backup",
    :text  => success ? "Backup successfully finished!" : "Backup failed!",
    :icon  => File.expand_path(success ? "success.png" : "failed.png", File.dirname(__FILE__))
  )
rescue => e
  Kernel.warn "Failed to notify via Growl: #{e.message}"
end