lib/time_block/cli.rb in time_block-0.0.1 vs lib/time_block/cli.rb in time_block-0.0.3

- old
+ new

@@ -1,12 +1,18 @@ require 'time_block' class TimeBlock::CLI def self.start(*args) + fail 'No terminal-notifier, please install it, brew install terminal-notifier' unless terminal_notifier_exist? time = args.shift.strip.to_i sleep time `terminal-notifier -message #{"Time is out dude !!!".dump} -title "TimeBlock - #{time}s" -sound "default"` rescue => e puts e.message exit(1) + end + + def self.terminal_notifier_exist? + `which terminal-notifier` + $? == 0 end end