Class: Autotest::Notify

Inherits:
Object
  • Object
show all
Defined in:
lib/autotest/notify.rb

Class Method Summary collapse

Class Method Details

.notify(state) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/autotest/notify.rb', line 3

def self.notify(state)
  pretty_state = state.to_s.capitalize
  title = "#{pretty_state} -- Autotest"
  
  command = case RUBY_PLATFORM
  when /linux/
    title = "'#{title}'"
    case linux_lib
    when :'notify-send' then "#{linux_lib} #{title}"
    when :kdialog then "#{linux_lib} --title #{title}"
    when :zenity then "#{linux_lib} --title #{title}"
    end
  when /darwin/
    "growlnotify -n autotest -m \"#{pretty_state}\" Autotest"
  when /cygwin/
    "sncmd /m '#{title}'"
  when /mswin/
    require 'snarl'
    Snarl.show_message(title)
    ''
  end

  system command
end