diff --git a/doc/CASK_LANGUAGE_REFERENCE.md b/doc/CASK_LANGUAGE_REFERENCE.md index beec9c750bc..81ffec8c605 100644 --- a/doc/CASK_LANGUAGE_REFERENCE.md +++ b/doc/CASK_LANGUAGE_REFERENCE.md @@ -219,6 +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`) | `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 diff --git a/lib/hbc/caveats.rb b/lib/hbc/caveats.rb index 87e86f914d1..578d1baddb7 100644 --- a/lib/hbc/caveats.rb +++ b/lib/hbc/caveats.rb @@ -77,6 +77,24 @@ class Hbc::CaveatsDSL end end + def depends_on_java(java_version = 'latest') + if java_version == 'latest' + puts <<-EOS.undent + #{@cask} requires Java. You can install the latest version with + + brew cask install java + + EOS + else + puts <<-EOS.undent + #{@cask} requires Java #{java_version}. You can install it with + + brew cask install caskroom/versions/java#{java_version} + + EOS + end + end + def logout puts <<-EOS.undent You must log out and log back in for the installation of #{@cask}