Last active
June 6, 2017 09:58
-
-
Save plagelao/c62170822562711388ccfda13513e21c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DynamodbLocal < Formula | |
desc "Client-side database and server imitating DynamoDB" | |
homepage "https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Tools.DynamoDBLocal.html" | |
url "https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz" | |
version "2016-05-17" | |
sha256 "d79732d7cd6e4b66fbf4bb7a7fc06cb75abbbe1bbbfb3d677a24815a1465a0b2" | |
bottle :unneeded | |
def data_path | |
var/"data/dynamodb-local" | |
end | |
def log_path | |
var/"log/dynamodb-local.log" | |
end | |
def bin_wrapper; <<-EOS.undent | |
#!/bin/sh | |
cd #{data_path} && exec java -Djava.library.path=#{libexec}/DynamodbLocal_lib -jar #{libexec}/DynamoDBLocal.jar "$@" | |
EOS | |
end | |
def install | |
prefix.install %w[LICENSE.txt README.txt third_party_licenses] | |
libexec.install %w[DynamoDBLocal_lib DynamoDBLocal.jar] | |
(bin/"dynamodb-local").write(bin_wrapper) | |
end | |
def post_install | |
data_path.mkpath | |
end | |
def caveats; <<-EOS.undent | |
DynamoDB Local supports the Java Runtime Engine (JRE) version 6.x or | |
newer; it will not run on older JRE versions. | |
Data: #{data_path} | |
Logs: #{log_path} | |
EOS | |
end | |
plist_options :manual => "#{HOMEBREW_PREFIX}/bin/dynamodb-local" | |
def plist; <<-EOS.undent | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>#{plist_name}</string> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>KeepAlive</key> | |
<false/> | |
<key>ProgramArguments</key> | |
<array> | |
<string>#{opt_bin}/dynamodb-local</string> | |
</array> | |
<key>StandardErrorPath</key> | |
<string>#{log_path}</string> | |
</dict> | |
</plist> | |
EOS | |
end | |
test do | |
system bin/"dynamodb-local", "-help" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment