class Teleport < Formula desc "Modern SSH server for teams managing distributed infrastructure" homepage "https://gravitational.com/teleport" url "https://github.com/gravitational/teleport/archive/v2.5.7.tar.gz" sha256 "26a62a4ae91482d51191f53edde01a93b13e23a257b5336de06e336ed39c8e7e" bottle do sha256 "7904263a8c1cde8e4e48022b6902f01ae107c1a1b98e978b01bf9807e39f6063" => :high_sierra sha256 "a82724892a7f5918712227fa1057c44a359b19449bbd5ceb1d148eda4f95bab0" => :sierra sha256 "13c7aaff13c2d537eae6ecc0ad333a114413e7288cd3dc2cd8ea403f5a921599" => :el_capitan end depends_on "go" => :build conflicts_with "etsh", :because => "both install `tsh` binaries" def install ENV["GOOS"] = "darwin" ENV["GOARCH"] = MacOS.prefer_64_bit? ? "amd64" : "386" ENV["GOPATH"] = buildpath ENV["GOROOT"] = Formula["go"].opt_libexec # Reported 21 Feb 2018 https://github.com/gravitational/teleport/issues/1708 inreplace "Makefile", "-j 3", "-j 1" (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