lib/talks.rb in talks-0.2.0 vs lib/talks.rb in talks-0.3.0
- old
+ new
@@ -1,10 +1,11 @@
require File.expand_path('../talks/configuration.rb', __FILE__)
require File.expand_path('../talks/hooks.rb', __FILE__)
+require 'notifier'
module Talks
- class << self
+ extend self
VOICES = {
:say => %w(
agnes albert alex bad bahh bells boing bruce bubbles cellos
deranged fred good hysterical junior kathy pipe princess ralph
@@ -33,14 +34,25 @@
when 'say'
`say -v #{say_voice(type, options)} '#{message}'`
when 'espeak'
`espeak -v #{say_voice(type, options)} '#{message}'`
else
- abort "Don't know that engine now: #{config.engine}"
+ abort "Undefined engine: #{config.engine}"
end
end
+ def notify(message, options = {})
+ Notifier.notify message: message, title: 'Talks', image: ''
+ end
+
+ def execute(command)
+ before_notify, command, after_notify = command
+ Talks.notify before_notify if before_notify
+ system command
+ Talks.notify after_notify if after_notify
+ end
+
def add_hooks(command)
Talks::Hooks.create command
end
TYPES.each do |type|
@@ -60,9 +72,8 @@
else
config.default_voice
end
end
- end
end
require File.expand_path('../talks/runner.rb', __FILE__)