homebrew-core/Formula/vault.rb

82 lines
2.7 KiB
Ruby

# Please don't update this formula until the release is official via
# mailing list or blog post. There's a history of GitHub tags moving around.
# https://github.com/hashicorp/vault/issues/1051
class Vault < Formula
desc "Secures, stores, and tightly controls access to secrets"
homepage "https://vaultproject.io/"
url "https://github.com/hashicorp/vault.git",
tag: "v1.7.2",
revision: "db0e4245d5119b5929e611ea4d9bf66e47f3f208"
license "MPL-2.0"
head "https://github.com/hashicorp/vault.git"
livecheck do
url "https://releases.hashicorp.com/vault/"
regex(%r{href=.*?v?(\d+(?:\.\d+)+)/?["' >]}i)
end
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "59dcde8e4b205eede07b296deb26892765274932877f92515ae4ccf7e96a108d"
sha256 cellar: :any_skip_relocation, big_sur: "dfb47517e60e62af028fd3f9b6ea44edba13b09b8e6f1f60117b5818eaef8447"
sha256 cellar: :any_skip_relocation, catalina: "2fcf55dd69557596f208d5bd02a5c50bcfb14d8b8eb41b3064f433bc6a02ca4a"
sha256 cellar: :any_skip_relocation, mojave: "ca6bbc64727611cfcec04778a6b8f36ad15db1b71f2b29979c736e9744fd7480"
end
depends_on "go" => :build
depends_on "gox" => :build
# Cannot build with `node` while upstream depends on node-sass<6
depends_on "node@14" => :build
depends_on "yarn" => :build
def install
ENV.prepend_path "PATH", "#{ENV["GOPATH"]}/bin"
system "make", "bootstrap", "static-dist", "dev-ui"
bin.install "bin/vault"
end
plist_options manual: "vault server -dev"
def plist
<<~EOS
<?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>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/vault</string>
<string>server</string>
<string>-dev</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>#{var}</string>
<key>StandardErrorPath</key>
<string>#{var}/log/vault.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/vault.log</string>
</dict>
</plist>
EOS
end
test do
port = free_port
ENV["VAULT_DEV_LISTEN_ADDRESS"] = "127.0.0.1:#{port}"
ENV["VAULT_ADDR"] = "http://127.0.0.1:#{port}"
pid = fork { exec bin/"vault", "server", "-dev" }
sleep 5
system bin/"vault", "status"
Process.kill("TERM", pid)
end
end