diff options
author | Florian Frank <flori@ping.de> | 2016-09-23 16:23:36 +0200 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2016-09-23 16:23:36 +0200 |
commit | 01167a57fce155afc62b95e3ae5d50e004af9580 (patch) | |
tree | 9f62729a648e12a9290c2fee229c46d26ac725cc /Rakefile | |
parent | 0689312047d5a2130a035baedbe9f46a1c498c06 (diff) | |
download | json-01167a57fce155afc62b95e3ae5d50e004af9580.tar.gz |
Simplify JAVA_HOME code
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -200,13 +200,11 @@ namespace :gems do end if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby' - if ENV.key?('JAVA_HOME') - warn " *** JAVA_HOME was set to #{ENV['JAVA_HOME'].inspect}" - elsif File.directory?(local_java = '/usr/local/java/jdk') || - File.directory?(local_java = '/usr/lib/jvm/java-6-openjdk') - then - ENV['JAVA_HOME'] = local_java - end + ENV['JAVA_HOME'] ||= [ + '/usr/local/java/jdk', + '/usr/lib/jvm/java-6-openjdk', + '/Library/Java/Home', + ].find { |c| File.directory?(c) } if ENV['JAVA_HOME'] warn " *** JAVA_HOME is set to #{ENV['JAVA_HOME'].inspect}" ENV['PATH'] = ENV['PATH'].split(/:/).unshift(java_path = "#{ENV['JAVA_HOME']}/bin") * ':' |