aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2012-03-04 16:56:59 -0800
committerAdam Vandenberg2012-03-05 21:14:39 -0800
commit09d23d91efd9a91af6798e485490f7a228c32eb1 (patch)
tree477343ca648ff03f4202f6c7628f62651e51749b /Library
parent6af1aae50bad076339db6cfe9c6af7898f4d8aea (diff)
downloadbrew-09d23d91efd9a91af6798e485490f7a228c32eb1.tar.bz2
Move AmazonWebServicesFormula to formula_specialties
Enough formulae in core depend on this, pull it in here. When multi-repo support lands, perhaps we could set up Homebrew-AWS.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula_specialties.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/Library/Homebrew/formula_specialties.rb b/Library/Homebrew/formula_specialties.rb
index 6aa469081..330b51c3e 100644
--- a/Library/Homebrew/formula_specialties.rb
+++ b/Library/Homebrew/formula_specialties.rb
@@ -14,3 +14,41 @@ class GithubGistFormula < ScriptFileFormula
@version=File.basename(File.dirname(url))[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 standard_install
+ rm Dir['bin/*.cmd'] # Remove Windows versions
+ prefix.install "bin"
+ # Put the .jars in prefix/jars/lib, which isn't linked to the Cellar
+ # This will prevent conflicts with other versions of these jars.
+ (prefix+'jars').install 'lib'
+ (prefix+'jars/bin').make_symlink '../bin'
+ end
+
+ # Use this method to generate standard caveats.
+ def standard_instructions var_name, var_value=prefix+'jars'
+ <<-EOS.undent
+ Before you can use these tools you must export some variables to your $SHELL
+ and download your X.509 certificate and private key from Amazon Web Services.
+
+ Your certificate and private key are available at:
+ http://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key
+
+ Download two ".pem" files, one starting with `pk-`, and one starting with `cert-`.
+ You need to put both into a folder in your home directory, `~/.ec2`.
+
+ 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 EC2_PRIVATE_KEY="$(/bin/ls $HOME/.ec2/pk-*.pem)"
+ export EC2_CERT="$(/bin/ls $HOME/.ec2/cert-*.pem)"
+ export #{var_name}="#{var_value}"
+ EOS
+ end
+end