homebrew-core/Formula/vault.rb

78 lines
2.4 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.5.0",
revision: "340cc2fa263f6cbd2861b41518da8a62c153e2e7"
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
cellar :any_skip_relocation
sha256 "1c4977affbeb09fc0c348ffc733f9bdbeeb9ae5825d5a9de77df8b00406c249d" => :catalina
sha256 "caab1a40567ae9a98d8b701ad658a0a491b5910390f8b498073d6669c7006251" => :mojave
sha256 "2d2182737f0e209b1725dfe00cd217b2c5a0f8cbe76c33747f15e2986ff0fdee" => :high_sierra
end
depends_on "go" => :build
depends_on "gox" => :build
depends_on "node@10" => :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
pid = fork { exec bin/"vault", "server", "-dev" }
sleep 1
ENV.append "VAULT_ADDR", "http://127.0.0.1:8200"
system bin/"vault", "status"
Process.kill("TERM", pid)
end
end