diff options
| author | Xu Cheng | 2015-03-04 11:12:48 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-03-04 23:20:13 +0800 |
| commit | c8835afead119761caa3e38193166387bb5a79f7 (patch) | |
| tree | 5382e9632fa1ef0bfeeae865a2a73138f4041e69 /Library/Homebrew/compat | |
| parent | cdb407435be7d71d3a8dae02ec2c99e7e2834388 (diff) | |
| download | brew-c8835afead119761caa3e38193166387bb5a79f7.tar.bz2 | |
move formula_specialties to compat
Closes Homebrew/homebrew#37365.
Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew/compat')
| -rw-r--r-- | Library/Homebrew/compat/formula_specialties.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Library/Homebrew/compat/formula_specialties.rb b/Library/Homebrew/compat/formula_specialties.rb new file mode 100644 index 000000000..96673fdea --- /dev/null +++ b/Library/Homebrew/compat/formula_specialties.rb @@ -0,0 +1,45 @@ +# Base classes for specialized types of formulae. + +# See chcase for an example +class ScriptFileFormula < Formula + def install + bin.install Dir['*'] + end +end + +# See browser for an example +class GithubGistFormula < ScriptFileFormula + def self.url(val) + super + version File.basename(File.dirname(val))[0, 6] + end +end + +# This formula serves as the base class for several very similar +# formulae for Amazon Web Services related tools. +class AmazonWebServicesFormula < Formula + # Use this method to peform a standard install for Java-based tools, + # keeping the .jars out of HOMEBREW_PREFIX/lib + def install + rm Dir['bin/*.cmd'] # Remove Windows versions + libexec.install Dir['*'] + bin.install_symlink Dir["#{libexec}/bin/*"] - ["#{libexec}/bin/service"] + end + alias_method :standard_install, :install + + # Use this method to generate standard caveats. + def standard_instructions home_name, home_value=libexec + <<-EOS.undent + Before you can use these tools you must export some variables to your $SHELL. + + To export the needed variables, add them to your dotfiles. + * On Bash, add them to `~/.bash_profile`. + * On Zsh, add them to `~/.zprofile` instead. + + export JAVA_HOME="$(/usr/libexec/java_home)" + export AWS_ACCESS_KEY="<Your AWS Access ID>" + export AWS_SECRET_KEY="<Your AWS Secret Key>" + export #{home_name}="#{home_value}" + EOS + end +end |
