From 2fc5fd4f0da4748a267e1dd6ac09fa031bc40982 Mon Sep 17 00:00:00 2001 From: "tka.lu" Date: Tue, 10 Mar 2015 00:55:57 +0800 Subject: [PATCH] terminal-notifier OSX 10.10 compatibility --- .../terminal-notifier/lib/terminal-notifier.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/ruby/common/terminal-notifier/lib/terminal-notifier.rb b/lib/ruby/common/terminal-notifier/lib/terminal-notifier.rb index ceb79245..ed7e83d6 100644 --- a/lib/ruby/common/terminal-notifier/lib/terminal-notifier.rb +++ b/lib/ruby/common/terminal-notifier/lib/terminal-notifier.rb @@ -2,12 +2,14 @@ module TerminalNotifier BIN_PATH = File.expand_path('../../vendor/compassapp-notifier/compassapp-notifier.app/Contents/MacOS/compassapp', __FILE__) class UnsupportedPlatformError < StandardError; end - # Returns wether or not the current platform is Mac OS X 10.8, or higher. + +# Returns wether or not the current platform is Mac OS X 10.8, or higher. def self.available? - if @available.nil? - @available = `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip >= '10.8' - end - @available + @available ||= Gem::Version.new(version) > Gem::Version.new('10.8') + end + + def self.version + @version ||= `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip end def self.execute(verbose, options)