lib/terminal-notifier-guard.rb in terminal-notifier-guard-1.6.4 vs lib/terminal-notifier-guard.rb in terminal-notifier-guard-1.7.0
- old
+ new
@@ -1,18 +1,19 @@
module TerminalNotifier
module Guard
- VERSION = "1.6.4"
+ VERSION = "1.7.0"
ICONS_PATH = File.expand_path("../../icons", __FILE__)
GUARD_ICON = File.join(ICONS_PATH, 'Guard.icns')
def self.osx_version
Gem::Version.new(`sw_vers -productVersion`.strip)
end
def self.terminal_notifier_version
return Gem::Version("0.0.0") unless installed?
- Gem::Version.new(`#{bin_path}`.lines.first.match(/\d\.\d\.\d/)[0])
+ # invoke the help option since the binary otherwise may get stuck
+ Gem::Version.new(`#{bin_path} -help`.lines.first.match(/\d\.\d\.\d/)[0])
rescue
Gem::Version.new("0.0.0")
end
def self.deprecation_check
@@ -39,10 +40,12 @@
def self.installed?
File.exist? bin_path
end
def self.bin_path
- @@binary ||= `which terminal-notifier`.chomp
+ ENV["TERMINAL_NOTIFIER_BIN"] || begin
+ @@binary ||= `which terminal-notifier`.chomp
+ end
end
def self.execute(verbose, options)
if available? && installed?
options.merge!({ :contentImage=> GUARD_ICON, :appIcon => icon(options.delete(:type)) })