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://dynamodb-local.s3.amazonaws.com/dynamodb_local_2016-05-17.tar.gz" version "2016-05-17" sha256 "832d474316c9d092de8c24885e69c9be9e22b9807e7383e0de6f247e44601a90" 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. In this release, the local database file format has changed; therefore, DynamoDB Local will not be able to read data files created by older releases. Data: #{data_path} Logs: #{log_path} EOS end plist_options :manual => "#{HOMEBREW_PREFIX}/bin/dynamodb-local" def plist; <<-EOS.undent Label #{plist_name} RunAtLoad KeepAlive ProgramArguments #{opt_bin}/dynamodb-local StandardErrorPath #{log_path} EOS end test do system bin/"dynamodb-local", "-help" end end