class Nomad < Formula desc "Distributed, Highly Available, Datacenter-Aware Scheduler" homepage "https://www.nomadproject.io" url "https://github.com/hashicorp/nomad/archive/v0.10.2.tar.gz" sha256 "0a62472744c157c4530b308cf92f56d2c051b929baf026e9fb002844f08beb09" head "https://github.com/hashicorp/nomad.git" bottle do cellar :any_skip_relocation sha256 "7244771c69e62a57d75f869a7c560611cddc99465212960a6f2feb8fb5d512f7" => :catalina sha256 "3a9fec957a987015448f7f072d4e814b9d68fbd4cb0f2c84d1102a0802b21da4" => :mojave sha256 "2a87bda37005f2fcefa793120675d4bd5965e0a88239fb051b04ef324104c9a9" => :high_sierra end depends_on "go" => :build def install ENV["GOPATH"] = buildpath src = buildpath/"src/github.com/hashicorp/nomad" src.install buildpath.children src.cd do system "go", "build", "-tags", "ui", "-o", bin/"nomad" prefix.install_metafiles end end plist_options :manual => "nomad agent -dev" def plist; <<~EOS KeepAlive SuccessfulExit Label #{plist_name} ProgramArguments #{opt_bin}/nomad agent -dev RunAtLoad WorkingDirectory #{var} StandardErrorPath #{var}/log/nomad.log StandardOutPath #{var}/log/nomad.log EOS end test do pid = fork do exec "#{bin}/nomad", "agent", "-dev" end sleep 10 ENV.append "NOMAD_ADDR", "http://127.0.0.1:4646" system "#{bin}/nomad", "node-status" ensure Process.kill("TERM", pid) end end