class Consul < Formula desc "Tool for service discovery, monitoring and configuration" homepage "https://www.consul.io" url "https://github.com/hashicorp/consul.git", :tag => "v0.9.3", :revision => "112c0603d3d6fb23ab5f15e8fdb1a761da8eaf9a" head "https://github.com/hashicorp/consul.git", :shallow => false bottle do cellar :any_skip_relocation sha256 "116c2a66ce62414ce9829c1e8ec93db61c8eb071dfb5832470f542b727a72b77" => :sierra sha256 "8598f078a558ecc6d2f23804280b8f8d692b40f340a387730497e2e5fc6877b0" => :el_capitan sha256 "8a3aa00a1e75e2524af83d1d2ff2cc71c5fc7e2ce0f0785ce1065acf85d4080b" => :yosemite end depends_on "go" => :build def install contents = Dir["{*,.git,.gitignore}"] gopath = buildpath/"gopath" (gopath/"src/github.com/hashicorp/consul").install contents ENV["GOPATH"] = gopath ENV.prepend_create_path "PATH", gopath/"bin" cd gopath/"src/github.com/hashicorp/consul" do system "make" bin.install "bin/consul" zsh_completion.install "contrib/zsh-completion/_consul" end end plist_options :manual => "consul agent -dev -advertise 127.0.0.1" def plist; <<-EOS.undent 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