Skip to content

Commit

Permalink
Add support for JRuby
Browse files Browse the repository at this point in the history
on jruby `RUBY_PLATFORM` returns `java` but relying only on java is insufficient. If we use rbconfig we will know for sure.
  • Loading branch information
vladson committed Mar 19, 2015
1 parent 134b103 commit 15c6162
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Ruby/lib/terminal-notifier.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
require 'shellwords'
require 'rbconfig'

module TerminalNotifier
BIN_PATH = File.expand_path('../../vendor/terminal-notifier/terminal-notifier.app/Contents/MacOS/terminal-notifier', __FILE__)

class UnsupportedPlatformError < StandardError; end
# Returns wether or not the current platform is Mac OS X 10.8, or higher.
def self.available?
@available ||= (/darwin/ =~ RUBY_PLATFORM) && Gem::Version.new(version) > Gem::Version.new('10.8')
@available ||= (/darwin|mac os/ =~ RbConfig::CONFIG['host_os']) && Gem::Version.new(version) > Gem::Version.new('10.8')
end

def self.version
Expand Down

0 comments on commit 15c6162

Please sign in to comment.