homebrew-core/Formula/vault.rb
2016-01-24 11:33:28 +00:00

73 lines
2.1 KiB
Ruby

require "language/go"
class Vault < Formula
desc "Secures, stores, and tightly controls access to secrets"
homepage "https://vaultproject.io/"
url "https://github.com/hashicorp/vault.git",
:tag => "v0.4.1",
:revision => "1a807d58cb4e87808a27d53bede3fa252b876871"
head "https://github.com/hashicorp/vault.git"
bottle do
cellar :any_skip_relocation
sha256 "fd61a56f03a3a8870a1f86b4370ca820d8659a6811a9e18e8ceb23347d533021" => :el_capitan
sha256 "8f04a8464775d0ba0bbce8b3a2697d58ee2bb004f220507de0dbe64d763ca5e7" => :yosemite
sha256 "f4e78dfa2fdc52870846cfe690aec36fa6af579b8758b30e40de6f87ac8bb95b" => :mavericks
end
depends_on "go" => :build
depends_on "godep" => :build
# godep's dependencies
go_resource "github.com/kr/fs" do
url "https://github.com/kr/fs.git",
:revision => "2788f0dbd16903de03cb8186e5c7d97b69ad387b"
end
go_resource "golang.org/x/tools" do
url "https://go.googlesource.com/tools.git",
:revision => "f3a63969dd29f8cfa913fdaea22f30c1ed537cb3"
end
go_resource "github.com/mitchellh/gox" do
url "https://github.com/mitchellh/gox.git",
:revision => "39862d88e853ecc97f45e91c1cdcb1b312c51eaa"
end
# gox dependency
go_resource "github.com/mitchellh/iochan" do
url "https://github.com/mitchellh/iochan.git",
:revision => "87b45ffd0e9581375c491fef3d32130bb15c5bd7"
end
def install
contents = Dir["{*,.git,.gitignore,.travis.yml}"]
gopath = buildpath/"gopath"
(gopath/"src/github.com/hashicorp/vault").install contents
ENV["GOPATH"] = gopath
ENV.prepend_create_path "PATH", gopath/"bin"
Language::Go.stage_deps resources, gopath/"src"
cd gopath/"src/github.com/mitchellh/gox" do
system "go", "install"
end
cd gopath/"src/github.com/hashicorp/vault" do
system "make", "dev"
bin.install "bin/vault"
end
end
test do
pid = fork do
exec "#{bin}/vault", "server", "-dev"
end
sleep 1
ENV.append "VAULT_ADDR", "http://127.0.0.1:8200"
system "#{bin}/vault", "status"
Process.kill("TERM", pid)
end
end