class Teleport < Formula desc "Modern SSH server for teams managing distributed infrastructure" homepage "https://gravitational.com/teleport" url "https://github.com/gravitational/teleport/archive/v4.0.8.tar.gz" sha256 "cb2c12dda463e09dbfd9195e149ea1e541a62d707827e3754bda885f603baf17" head "https://github.com/gravitational/teleport.git" bottle do cellar :any_skip_relocation sha256 "d7b5367852a4a111caac16f308c36b782f08352457a8c1b814b7ea0a72649743" => :mojave sha256 "dec3188c8085505b9a132175ad49345c29afa2ccfd6ab326ebfd043d5ace60e3" => :high_sierra sha256 "c77d4f267f15bb0617b69cd71e4423ae38f1571a79d2cca1baa28ec92684c3a8" => :sierra end depends_on "go" => :build conflicts_with "etsh", :because => "both install `tsh` binaries" def install ENV["GOOS"] = "darwin" ENV["GOARCH"] = "amd64" ENV["GOPATH"] = buildpath ENV["GOROOT"] = Formula["go"].opt_libexec (buildpath/"src/github.com/gravitational/teleport").install buildpath.children cd "src/github.com/gravitational/teleport" do ENV.deparallelize { system "make", "full" } bin.install Dir["build/*"] prefix.install_metafiles end end test do assert_match version.to_s, shell_output("#{bin}/teleport version") (testpath/"config.yml").write shell_output("#{bin}/teleport configure") .gsub("0.0.0.0", "127.0.0.1") .gsub("/var/lib/teleport", testpath) .gsub("/var/run", testpath) .gsub(/https_(.*)/, "") begin pid = spawn("#{bin}/teleport start -c #{testpath}/config.yml") sleep 5 system "/usr/bin/curl", "--insecure", "https://localhost:3080" system "/usr/bin/nc", "-z", "localhost", "3022" system "/usr/bin/nc", "-z", "localhost", "3023" system "/usr/bin/nc", "-z", "localhost", "3025" ensure Process.kill(9, pid) end end end