From 15c6162d94d6b574eab269f30228a2d149779aa2 Mon Sep 17 00:00:00 2001 From: Vladislav Bogomolov Date: Thu, 19 Mar 2015 18:24:14 +0300 Subject: [PATCH] Add support for JRuby on jruby `RUBY_PLATFORM` returns `java` but relying only on java is insufficient. If we use rbconfig we will know for sure. --- Ruby/lib/terminal-notifier.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Ruby/lib/terminal-notifier.rb b/Ruby/lib/terminal-notifier.rb index 16f4ec0..44697ce 100644 --- a/Ruby/lib/terminal-notifier.rb +++ b/Ruby/lib/terminal-notifier.rb @@ -1,4 +1,5 @@ require 'shellwords' +require 'rbconfig' module TerminalNotifier BIN_PATH = File.expand_path('../../vendor/terminal-notifier/terminal-notifier.app/Contents/MacOS/terminal-notifier', __FILE__) @@ -6,7 +7,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 ||= (/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