From c8835afead119761caa3e38193166387bb5a79f7 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Wed, 4 Mar 2015 11:12:48 +0800 Subject: move formula_specialties to compat Closes Homebrew/homebrew#37365. Signed-off-by: Xu Cheng --- Library/Homebrew/compat.rb | 1 + Library/Homebrew/compat/formula_specialties.rb | 45 ++++++++++++++++++++++++++ Library/Homebrew/formula.rb | 1 - Library/Homebrew/formula_specialties.rb | 45 -------------------------- Library/Homebrew/test/test_formula_install.rb | 1 + 5 files changed, 47 insertions(+), 46 deletions(-) create mode 100644 Library/Homebrew/compat/formula_specialties.rb delete mode 100644 Library/Homebrew/formula_specialties.rb (limited to 'Library') diff --git a/Library/Homebrew/compat.rb b/Library/Homebrew/compat.rb index a5c28e46b..4343f4bc3 100644 --- a/Library/Homebrew/compat.rb +++ b/Library/Homebrew/compat.rb @@ -1,5 +1,6 @@ require 'compat/fails_with_llvm' require 'compat/formula' +require 'compat/formula_specialties' require 'compat/hardware' require 'compat/macos' require 'compat/md5' 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="" + export AWS_SECRET_KEY="" + export #{home_name}="#{home_value}" + EOS + end +end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 2edb44f59..218fb9b7c 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1009,4 +1009,3 @@ class Formula end end -require 'formula_specialties' diff --git a/Library/Homebrew/formula_specialties.rb b/Library/Homebrew/formula_specialties.rb deleted file mode 100644 index 96673fdea..000000000 --- a/Library/Homebrew/formula_specialties.rb +++ /dev/null @@ -1,45 +0,0 @@ -# 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="" - export AWS_SECRET_KEY="" - export #{home_name}="#{home_value}" - EOS - end -end diff --git a/Library/Homebrew/test/test_formula_install.rb b/Library/Homebrew/test/test_formula_install.rb index 399571620..c9357e8ce 100644 --- a/Library/Homebrew/test/test_formula_install.rb +++ b/Library/Homebrew/test/test_formula_install.rb @@ -1,5 +1,6 @@ require 'testing_env' require 'formula' +require 'compat/formula_specialties' require 'testball' require 'keg' -- cgit v1.2.3