Merge pull request #16594 from vitorgalvao/java-caveat

Java caveat
This commit is contained in:
Vítor Galvão 2016-01-08 16:42:51 +00:00
commit b7e052d637
2 changed files with 10 additions and 3 deletions

View File

@ -219,7 +219,7 @@ The following methods may be called to generate standard warning messages:
| --------------------------------- | ----------- |
| `path_environment_variable(path)` | users should make sure `path` is in their `$PATH` environment variable
| `zsh_path_helper(path)` | zsh users must take additional steps to make sure `path` is in their `$PATH` environment variable
| `depends_on_java(version)` | users should make sure they have the specified version of java installed (`version` should be one of `6`, `7`, or empty for `8`)
| `depends_on_java(version)` | users should make sure they have the specified version of java installed. `version` can be exact (e.g. `6`), a minimum (e.g. `7+`), or omitted (when any version works).
| `logout` | users should log out and log back in to complete installation
| `reboot` | users should reboot to complete installation
| `files_in_usr_local` | the Cask installs files to `/usr/local`, which may confuse Homebrew

View File

@ -77,13 +77,20 @@ class Hbc::CaveatsDSL
end
end
def depends_on_java(java_version = 'latest')
if java_version == 'latest'
def depends_on_java(java_version = 'any')
if java_version == 'any'
puts <<-EOS.undent
#{@cask} requires Java. You can install the latest version with
brew cask install java
EOS
elsif java_version =~ /8/ || java_version =~ /\+/
puts <<-EOS.undent
#{@cask} requires Java #{java_version}. You can install the latest version with
brew cask install java
EOS
else
puts <<-EOS.undent