Extract base class for Amazon Web Services.
Many Amazon Web Service tool bundles have similar setup steps and caveats, so extract a base class and use that for other formulae.
This commit is contained in:
parent
7190e2ff35
commit
b4ac7d994a
1 changed files with 35 additions and 17 deletions
|
@ -1,24 +1,21 @@
|
||||||
require 'formula'
|
require 'formula'
|
||||||
|
|
||||||
class Ec2ApiTools <Formula
|
# This formula serves as the base class for several very similar
|
||||||
homepage 'http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351'
|
# formulae for Amazon Web Services related tools.
|
||||||
url 'http://ec2-downloads.s3.amazonaws.com/ec2-api-tools-1.3-51254.zip'
|
|
||||||
md5 '4644d3984009f576b1c34c6d60086e60'
|
|
||||||
|
|
||||||
def patches
|
class AmazonWebServicesFormula <Formula
|
||||||
# (From http://gist.github.com/200283) Gets rid of the
|
# Use this method to peform a standard install for Java-based tools,
|
||||||
# "[Deprecated] Xalan: org.apache.xml.res.XMLErrorResources_en_US"
|
# keeping the .jars out of HOMEBREW_PREFIX/lib
|
||||||
# messages that the tools spew on 1.3-41620 under Snow Leopard
|
def standard_install
|
||||||
DATA
|
|
||||||
end
|
|
||||||
|
|
||||||
def install
|
|
||||||
rm Dir['bin/*.cmd'] # Remove Windows versions
|
rm Dir['bin/*.cmd'] # Remove Windows versions
|
||||||
bin.install Dir['bin/ec2-*'] # Install commands to bin
|
prefix.install "bin"
|
||||||
prefix.install 'lib' # Put the .jars in prefix/lib
|
# 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'
|
||||||
end
|
end
|
||||||
|
|
||||||
def caveats
|
# Use this method to generate standard caveats.
|
||||||
|
def standard_instructions var_name, var_value=prefix+'jars'
|
||||||
<<-EOS.undent
|
<<-EOS.undent
|
||||||
Before you can use these tools you must export some variables to your $SHELL
|
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.
|
and download your X.509 certificate and private key from Amazon Web Services.
|
||||||
|
@ -33,14 +30,35 @@ class Ec2ApiTools <Formula
|
||||||
* On Bash, add them to `~/.bash_profile`.
|
* On Bash, add them to `~/.bash_profile`.
|
||||||
* On Zsh, add them to `~/.zprofile` instead.
|
* On Zsh, add them to `~/.zprofile` instead.
|
||||||
|
|
||||||
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home/"
|
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
|
||||||
export EC2_HOME="#{prefix}/"
|
|
||||||
export EC2_PRIVATE_KEY="$(/bin/ls $HOME/.ec2/pk-*.pem)"
|
export EC2_PRIVATE_KEY="$(/bin/ls $HOME/.ec2/pk-*.pem)"
|
||||||
export EC2_CERT="$(/bin/ls $HOME/.ec2/cert-*.pem)"
|
export EC2_CERT="$(/bin/ls $HOME/.ec2/cert-*.pem)"
|
||||||
|
export #{var_name}="#{var_value}"
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class Ec2ApiTools <AmazonWebServicesFormula
|
||||||
|
homepage 'http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351'
|
||||||
|
url 'http://ec2-downloads.s3.amazonaws.com/ec2-api-tools-1.3-51254.zip'
|
||||||
|
md5 '4644d3984009f576b1c34c6d60086e60'
|
||||||
|
|
||||||
|
def patches
|
||||||
|
# Gets rid of the "[Deprecated] Xalan: org.apache.xml.res.XMLErrorResources_en_US"
|
||||||
|
# messages that the tools spew on 1.3-41620 under Snow Leopard
|
||||||
|
# See: http://gist.github.com/200283
|
||||||
|
DATA
|
||||||
|
end
|
||||||
|
|
||||||
|
def install
|
||||||
|
standard_install
|
||||||
|
end
|
||||||
|
|
||||||
|
def caveats
|
||||||
|
standard_instructions "EC2_HOME"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
diff --git i/bin/ec2-cmd w/bin/ec2-cmd
|
diff --git i/bin/ec2-cmd w/bin/ec2-cmd
|
||||||
index 57051eb..edc2aae 100755
|
index 57051eb..edc2aae 100755
|
||||||
|
|
Loading…
Reference in a new issue