Class: CheckZilla::Notifier::NotifySend

Inherits:
Object
  • Object
show all
Defined in:
lib/checkzilla/notifier/notify_send.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ NotifySend

Returns a new instance of NotifySend.



5
6
7
# File 'lib/checkzilla/notifier/notify_send.rb', line 5

def initialize &block
  self
end

Instance Method Details

#perform!(checkers) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/checkzilla/notifier/notify_send.rb', line 9

def perform! checkers
  checkers.each do |checker|
    checker_name = checker.class.name.split("::").last
    title = "CheckZilla: #{checker_name}"

    body = []
    checker.results.each do |name, versions|
      local_version = versions[0]
      newer_version = versions[1]
      body << "#{name} (#{local_version} -> #{newer_version})"
    end
    `notify-send -u normal "#{title}" "#{body.join(', ')}"` if body.size > 0
  end
end