homebrew-core/Formula/consul-template.rb

40 lines
1.3 KiB
Ruby

class ConsulTemplate < Formula
desc "Generic template rendering and notifications with Consul"
homepage "https://github.com/hashicorp/consul-template"
url "https://github.com/hashicorp/consul-template.git",
:tag => "v0.18.1",
:revision => "e9bbed7053974ed6c3b6d329bb3786afa961af01"
head "https://github.com/hashicorp/consul-template.git"
bottle do
cellar :any_skip_relocation
sha256 "91bb13839501e29a3a9fa5cd01252fc286790643641e09ceab82aad240ed9ca6" => :sierra
sha256 "0e2cdcdbb3898a26ec07b08b7dbb80a13cf74e019dcd3a67436e89da26eacd5f" => :el_capitan
sha256 "a8f46fc1966ef98ed2cfc70507b32e58df21ca3ff9729f20cc4916d858d10459" => :yosemite
end
depends_on "go" => :build
def install
ENV["GOPATH"] = buildpath
arch = MacOS.prefer_64_bit? ? "amd64" : "386"
ENV["XC_OS"] = "darwin"
ENV["XC_ARCH"] = arch
dir = buildpath/"src/github.com/hashicorp/consul-template"
dir.install buildpath.children - [buildpath/".brew_home"]
cd dir do
system "make", "bin-local"
bin.install "pkg/darwin_#{arch}/consul-template"
end
end
test do
(testpath/"template").write <<-EOS.undent
{{"homebrew" | toTitle}}
EOS
system bin/"consul-template", "-once", "-template", "template:test-result"
assert_equal "Homebrew", (testpath/"test-result").read.chomp
end
end