Skip to content

Commit

Permalink
Prevented exceptions on non-Mac OS X platforms
Browse files Browse the repository at this point in the history
Fixed the version error and also prevented the exception from being thrown on non-Mac OSX platforms. This was screwing up guard notifications on Linux in cross platform projects.
  • Loading branch information
aspinall committed Oct 16, 2014
1 parent 6165274 commit ad8c031
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Ruby/lib/terminal-notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module TerminalNotifier
class UnsupportedPlatformError < StandardError; end
# Returns wether or not the current platform is Mac OS X 10.8, or higher.
def self.available?
@available ||= Gem::Version.new(version) > Gem::Version.new('10.8')
@available ||= (/darwin/ =~ RUBY_PLATFORM) && Gem::Version.new(version) > Gem::Version.new('10.8')
end

def self.version
Expand All @@ -25,7 +25,7 @@ def self.execute(verbose, options)
end
result
else
raise UnsupportedPlatformError, "terminal-notifier is only supported on Mac OS X 10.8, or higher."
STDERR.print "terminal-notifier is only supported on Mac OS X 10.8, or higher."
end
end

Expand Down

0 comments on commit ad8c031

Please sign in to comment.