JavaRequirement: check satisfaction directly

It made less sense to call a method `java_version` when it returns
boolean value.

Closes Homebrew/homebrew#45501.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Xu Cheng 2015-10-30 14:44:43 +08:00
parent e40e1b7ac7
commit d7a479f551

View File

@ -5,7 +5,12 @@ class JavaRequirement < Requirement
cask "java"
download "http://www.oracle.com/technetwork/java/javase/downloads/index.html"
satisfy(:build_env => false) { java_version }
satisfy :build_env => false do
args = %w[--failfast]
args << "--version" << "#{@version}" if @version
@java_home = Utils.popen_read("/usr/libexec/java_home", *args).chomp
$?.success?
end
env do
java_home = Pathname.new(@java_home)
@ -24,13 +29,6 @@ class JavaRequirement < Requirement
super
end
def java_version
args = %w[--failfast]
args << "--version" << "#{@version}" if @version
@java_home = Utils.popen_read("/usr/libexec/java_home", *args).chomp
$?.success?
end
def message
version_string = " #{@version}" if @version