Module: AutotestNotification
- Defined in:
- lib/autotest_notification/version.rb,
lib/autotest_notification.rb,
lib/autotest_notification/mac.rb,
lib/autotest_notification/doom.rb,
lib/autotest_notification/linux.rb,
lib/autotest_notification/cygwin.rb,
lib/autotest_notification/windows.rb
Overview
:nodoc:
Defined Under Namespace
Modules: VERSION Classes: Cygwin, Doom, Linux, Mac, Windows
Constant Summary collapse
- IMAGES_DIRECTORY =
File.(File.dirname(__FILE__) + "/../images/")
- SUCCESS_IMAGE =
"#{IMAGES_DIRECTORY}/pass.png"
- FAIL_IMAGE =
"#{IMAGES_DIRECTORY}/fail.png"
- EXPIRATION_IN_SECONDS =
3
- @@sound_path =
File.(File.dirname(__FILE__) + "/../sound/")
- @@sound_app =
'mpg321'
- @@process_devnull =
'> /dev/null 2>&1'
- @@process_bg =
'&'
Class Method Summary collapse
- .notify(title, msg, img = SUCCESS_IMAGE, total = 1, failures = 0, pri = 0) ⇒ Object
- .playsound(file) ⇒ Object
- .pluralize(text, number) ⇒ Object
- .process_bg=(o) ⇒ Object
- .process_devnull=(o) ⇒ Object
- .rspec_message(examples, failures, pendings) ⇒ Object
- .sound_app=(o) ⇒ Object
- .sound_path=(o) ⇒ Object
- .unit_test_message(tests, assertions, failures, errors) ⇒ Object
Class Method Details
.notify(title, msg, img = SUCCESS_IMAGE, total = 1, failures = 0, pri = 0) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/autotest_notification.rb', line 53 def notify(title, msg, img = SUCCESS_IMAGE, total = 1, failures = 0, pri = 0) img = Doom.image(total, failures) if DOOM_EDITION case RUBY_PLATFORM when /linux/ Linux.notify(title, msg, img, failures) when /darwin/ Mac.notify(title, msg, img, failures, pri) when /cygwin/ Cygwin.notify(title, msg, img) when /mswin/ Windows.notify(title, msg, img) end end |
.playsound(file) ⇒ Object
97 98 99 100 101 102 103 |
# File 'lib/autotest_notification.rb', line 97 def playsound file if NOISE cmd = "#{@@sound_app} #{@@sound_path}/#{file} #{@@process_devnull} #{@@process_bg}" puts "========== #{cmd}" system cmd end end |
.pluralize(text, number) ⇒ Object
69 70 71 |
# File 'lib/autotest_notification.rb', line 69 def pluralize(text, number) "#{number} #{text}#{'s' if number != 1}" end |
.process_bg=(o) ⇒ Object
93 94 95 |
# File 'lib/autotest_notification.rb', line 93 def process_bg= o @@process_bg = o end |
.process_devnull=(o) ⇒ Object
89 90 91 |
# File 'lib/autotest_notification.rb', line 89 def process_devnull= o @@process_devnull = o end |
.rspec_message(examples, failures, pendings) ⇒ Object
77 78 79 |
# File 'lib/autotest_notification.rb', line 77 def (examples, failures, pendings) "#{pluralize('example', examples)}, #{pluralize('failure', failures)}, #{pendings} pending" end |
.sound_app=(o) ⇒ Object
85 86 87 |
# File 'lib/autotest_notification.rb', line 85 def sound_app= o @@sound_app = o end |
.sound_path=(o) ⇒ Object
81 82 83 |
# File 'lib/autotest_notification.rb', line 81 def sound_path= o @@sound_path = o end |
.unit_test_message(tests, assertions, failures, errors) ⇒ Object
73 74 75 |
# File 'lib/autotest_notification.rb', line 73 def (tests, assertions, failures, errors) "#{pluralize('test', tests)}, #{pluralize('assertion', assertions)}, #{pluralize('failure', failures)}, #{pluralize('error', errors)}" end |