diff --git a/Formula/consul-template.rb b/Formula/consul-template.rb index 92554eb54c..f0236c87fd 100644 --- a/Formula/consul-template.rb +++ b/Formula/consul-template.rb @@ -1,11 +1,26 @@ -require "language/go" - 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.16.0", - :revision => "efa462daa2b961bff683677146713f4008555fba" + head "https://github.com/hashicorp/consul-template.git" + + stable do + url "https://github.com/hashicorp/consul-template.git", + :tag => "v0.16.0", + :revision => "efa462daa2b961bff683677146713f4008555fba" + + # The stable block can be removed on next stable version as the below + # go_resource dependencies are no longer required. + # Ref: https://github.com/hashicorp/consul-template/issues/793 + require "language/go" + go_resource "github.com/mitchellh/gox" do + url "https://github.com/mitchellh/gox.git", + :revision => "c9740af9c6574448fd48eb30a71f964014c7a837" + end + go_resource "github.com/mitchellh/iochan" do + url "https://github.com/mitchellh/iochan.git", + :revision => "87b45ffd0e9581375c491fef3d32130bb15c5bd7" + end + end bottle do cellar :any_skip_relocation @@ -16,50 +31,35 @@ class ConsulTemplate < Formula devel do url "https://github.com/hashicorp/consul-template.git", - :tag => "v0.18.0-rc1", - :revision => "933192dc0b6bb642af2549848e0681670550e095" - version "0.18.0-rc1" - - # Upstream issue "Request: Makefile target that doesn't use docker" - # Reported 18 Nov 2016 https://github.com/hashicorp/consul-template/issues/793 - patch :DATA - end - - head do - url "https://github.com/hashicorp/consul-template.git" - - patch :DATA + :tag => "v0.18.0-rc2", + :revision => "e446ab16fb567e1ddeb88ef29406b53bdb4ee387" + version "0.18.0-rc2" end depends_on "go" => :build - go_resource "github.com/mitchellh/gox" do - url "https://github.com/mitchellh/gox.git", - :revision => "c9740af9c6574448fd48eb30a71f964014c7a837" - end - - # gox dependency - go_resource "github.com/mitchellh/iochan" do - url "https://github.com/mitchellh/iochan.git", - :revision => "87b45ffd0e9581375c491fef3d32130bb15c5bd7" - end - 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 - - Language::Go.stage_deps resources, buildpath/"src" - ENV.prepend_create_path "PATH", buildpath/"bin" - cd("src/github.com/mitchellh/gox") { system "go", "install" } + dir.install buildpath.children - [buildpath/".brew_home"] cd dir do - system "make", "dev" - system "make", "test" + if build.stable? + # On next stable release, this if/else block can be replaced below with + # just the steps in the else block. + Language::Go.stage_deps resources, buildpath/"src" + ENV.prepend_create_path "PATH", buildpath/"bin" + cd(buildpath/"src/github.com/mitchellh/gox") { system "go", "install" } + system "make", "dev" + bin.install "bin/consul-template" + else + system "make", "bin-local" + bin.install "pkg/darwin_#{arch}/consul-template" + end end - - bin.install "bin/consul-template" end test do @@ -70,39 +70,3 @@ class ConsulTemplate < Formula assert_equal "Homebrew", (testpath/"test-result").read.chomp end end - -__END__ -diff --git a/Makefile b/Makefile -index 4d5304c..917fb7b 100644 ---- a/Makefile -+++ b/Makefile -@@ -35,19 +35,16 @@ GOFILES = $(shell go list $(TEST) | grep -v /vendor/) - # environment variables. - bin: - @echo "==> Building ${PROJECT}..." -- @docker run \ -- --rm \ -- --env="VERSION=${VERSION}" \ -- --env="PROJECT=${PROJECT}" \ -- --env="OWNER=${OWNER}" \ -- --env="NAME=${NAME}" \ -- --env="XC_OS=${XC_OS}" \ -- --env="XC_ARCH=${XC_ARCH}" \ -- --env="XC_EXCLUDE=${XC_EXCLUDE}" \ -- --env="DIST=${DIST}" \ -- --workdir="/go/src/${PROJECT}" \ -- --volume="${CURRENT_DIR}:/go/src/${PROJECT}" \ -- "golang:${GOVERSION}" /bin/sh -c "scripts/compile.sh" -+ env \ -+ VERSION="${VERSION}" \ -+ PROJECT="${PROJECT}" \ -+ OWNER="${OWNER}" \ -+ NAME="${NAME}" \ -+ XC_OS="${XC_OS}" \ -+ XC_ARCH="${XC_ARCH}" \ -+ XC_EXCLUDE="${XC_EXCLUDE}" \ -+ DIST="${DIST}" \ -+ sh -c "'${CURDIR}/scripts/compile.sh'" - - # bootstrap installs the necessary go tools for development or build - bootstrap: