2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-09-21 07:43:18 +00:00
|
|
|
|
2010-05-20 03:26:52 +00:00
|
|
|
# This formula serves as the base class for several very similar
|
|
|
|
# formulae for Amazon Web Services related tools.
|
2010-05-20 03:14:41 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class AmazonWebServicesFormula < Formula
|
2010-05-20 03:26:52 +00:00
|
|
|
# Use this method to peform a standard install for Java-based tools,
|
|
|
|
# keeping the .jars out of HOMEBREW_PREFIX/lib
|
|
|
|
def standard_install
|
2010-05-20 03:14:41 +00:00
|
|
|
rm Dir['bin/*.cmd'] # Remove Windows versions
|
2010-05-20 03:26:52 +00:00
|
|
|
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'
|
2010-07-29 11:05:09 +00:00
|
|
|
(prefix+'jars/bin').make_symlink '../bin'
|
2009-09-21 07:43:18 +00:00
|
|
|
end
|
|
|
|
|
2010-05-20 03:26:52 +00:00
|
|
|
# Use this method to generate standard caveats.
|
|
|
|
def standard_instructions var_name, var_value=prefix+'jars'
|
2010-05-20 03:14:41 +00:00
|
|
|
<<-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.
|
2009-09-21 07:43:18 +00:00
|
|
|
|
2010-05-20 03:14:41 +00:00
|
|
|
Your certificate and private key are available at:
|
|
|
|
http://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key
|
2009-09-21 07:43:18 +00:00
|
|
|
|
2010-05-20 03:14:41 +00:00
|
|
|
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`.
|
2009-09-21 07:43:18 +00:00
|
|
|
|
2010-05-20 03:14:41 +00:00
|
|
|
To export the needed variables, add them to your dotfiles.
|
|
|
|
* On Bash, add them to `~/.bash_profile`.
|
|
|
|
* On Zsh, add them to `~/.zprofile` instead.
|
2009-09-21 07:43:18 +00:00
|
|
|
|
2010-05-20 03:26:52 +00:00
|
|
|
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
|
2010-05-20 03:14:41 +00:00
|
|
|
export EC2_PRIVATE_KEY="$(/bin/ls $HOME/.ec2/pk-*.pem)"
|
|
|
|
export EC2_CERT="$(/bin/ls $HOME/.ec2/cert-*.pem)"
|
2010-05-20 03:26:52 +00:00
|
|
|
export #{var_name}="#{var_value}"
|
2009-09-21 07:43:18 +00:00
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|
2009-10-18 06:39:27 +00:00
|
|
|
|
2010-05-20 03:26:52 +00:00
|
|
|
class Ec2ApiTools <AmazonWebServicesFormula
|
|
|
|
homepage 'http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351'
|
2010-12-19 19:14:56 +00:00
|
|
|
url 'http://ec2-downloads.s3.amazonaws.com/ec2-api-tools-1.3-62308.zip'
|
|
|
|
md5 'cd0de5244f01a3d402ec2461d05f06aa'
|
2010-05-20 03:26:52 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
standard_install
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats
|
|
|
|
standard_instructions "EC2_HOME"
|
|
|
|
end
|
|
|
|
end
|