class Consul < Formula desc "Tool for service discovery, monitoring and configuration" homepage "https://www.consul.io" url "https://github.com/hashicorp/consul.git", :tag => "v1.4.4", :revision => "ea5210a30e154f4da9a4c8e729b45b8ce7b9b92c" head "https://github.com/hashicorp/consul.git", :shallow => false bottle do cellar :any_skip_relocation sha256 "3e97e5e604475174cb8a30296171530f4482bd1d051863311f31445285bdc872" => :mojave sha256 "97fcc94edc368fe577cee71fb6652c475e34c69ec363d62d3ba890550b544b82" => :high_sierra sha256 "1a16178f018ca4643e5ef0ff04fe614062743c9d5d69fbb443f9eb6208226af5" => :sierra end depends_on "go" => :build depends_on "gox" => :build def install # Avoid running `go get` inreplace "GNUmakefile", "go get -u -v $(GOTOOLS)", "" ENV["XC_OS"] = "darwin" ENV["XC_ARCH"] = "amd64" ENV["GOPATH"] = buildpath contents = Dir["{*,.git,.gitignore}"] (buildpath/"src/github.com/hashicorp/consul").install contents (buildpath/"bin").mkpath cd "src/github.com/hashicorp/consul" do system "make" bin.install "bin/consul" prefix.install_metafiles end end plist_options :manual => "consul agent -dev -advertise 127.0.0.1" def plist; <<~EOS KeepAlive SuccessfulExit Label #{plist_name} ProgramArguments #{opt_bin}/consul agent -dev -advertise 127.0.0.1 RunAtLoad WorkingDirectory #{var} StandardErrorPath #{var}/log/consul.log StandardOutPath #{var}/log/consul.log EOS end test do fork do exec "#{bin}/consul", "agent", "-data-dir", "." end sleep 3 system "#{bin}/consul", "leave" end end