2016-06-16 06:29:46 +00:00
|
|
|
require "language/go"
|
|
|
|
|
2015-10-05 21:35:32 +00:00
|
|
|
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",
|
2016-09-18 14:18:50 +00:00
|
|
|
tag: "v0.15.0",
|
|
|
|
revision: "6dc5d0f9c4cbc62828c91a923482c2341d36acb3"
|
2015-10-05 21:35:32 +00:00
|
|
|
head "https://github.com/hashicorp/consul-template.git"
|
|
|
|
|
2015-10-06 23:11:17 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any_skip_relocation
|
2016-06-16 06:41:28 +00:00
|
|
|
revision 1
|
|
|
|
sha256 "49c894d63c468c091027e200746a4c5aef63303407b96a8e51d87240a2596103" => :el_capitan
|
|
|
|
sha256 "32ff7ce9b758e60b7194a3d403a57177737967046cbf88d461437eda4cf0c85a" => :yosemite
|
|
|
|
sha256 "e1567a7ebe4e7f7c0710f47138566044acca5f4694181566b662f8884025ddaf" => :mavericks
|
2015-10-06 23:11:17 +00:00
|
|
|
end
|
|
|
|
|
2016-07-13 11:04:53 +00:00
|
|
|
devel do
|
|
|
|
url "https://github.com/hashicorp/consul-template.git",
|
2016-09-18 14:18:50 +00:00
|
|
|
tag: "v0.16.0-rc1",
|
|
|
|
revision: "95065346ba9a95564536f2154dfb054c18cc5cc3"
|
2016-07-13 11:04:53 +00:00
|
|
|
version "0.16.0-rc1"
|
|
|
|
end
|
|
|
|
|
2015-10-05 21:35:32 +00:00
|
|
|
depends_on "go" => :build
|
|
|
|
|
2016-06-16 06:29:46 +00:00
|
|
|
go_resource "github.com/mitchellh/gox" do
|
|
|
|
url "https://github.com/mitchellh/gox.git",
|
2016-09-18 14:18:50 +00:00
|
|
|
revision: "6e9ee79eab7bb1b84155379b3f94ff9a87b344e4"
|
2016-06-16 06:29:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# gox dependency
|
|
|
|
go_resource "github.com/mitchellh/iochan" do
|
|
|
|
url "https://github.com/mitchellh/iochan.git",
|
2016-09-18 14:18:50 +00:00
|
|
|
revision: "87b45ffd0e9581375c491fef3d32130bb15c5bd7"
|
2016-06-16 06:29:46 +00:00
|
|
|
end
|
|
|
|
|
2015-10-05 21:35:32 +00:00
|
|
|
def install
|
2015-11-17 06:51:40 +00:00
|
|
|
ENV["GOPATH"] = buildpath
|
2016-06-16 06:29:46 +00:00
|
|
|
|
2016-06-11 17:15:03 +00:00
|
|
|
dir = buildpath/"src/github.com/hashicorp/consul-template"
|
|
|
|
dir.install buildpath.children
|
2016-06-16 06:29:46 +00:00
|
|
|
|
|
|
|
Language::Go.stage_deps resources, buildpath/"src"
|
|
|
|
ENV.prepend_create_path "PATH", buildpath/"bin"
|
|
|
|
cd("src/github.com/mitchellh/gox") { system "go", "install" }
|
|
|
|
|
2016-06-11 17:15:03 +00:00
|
|
|
cd dir do
|
|
|
|
system "make", "updatedeps" if build.head?
|
|
|
|
system "make", "dev"
|
|
|
|
system "make", "test"
|
2015-10-05 21:35:32 +00:00
|
|
|
end
|
2016-06-16 06:29:46 +00:00
|
|
|
|
2016-06-11 17:15:03 +00:00
|
|
|
bin.install "bin/consul-template"
|
2015-10-05 21:35:32 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2016-06-11 17:15:03 +00:00
|
|
|
(testpath/"template").write <<-EOS.undent
|
2015-10-05 21:35:32 +00:00
|
|
|
{{"homebrew" | toTitle}}
|
|
|
|
EOS
|
2016-06-11 17:15:03 +00:00
|
|
|
system bin/"consul-template", "-once", "-template", "template:test-result"
|
|
|
|
assert_equal "Homebrew", (testpath/"test-result").read.chomp
|
2015-10-05 21:35:32 +00:00
|
|
|
end
|
|
|
|
end
|