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.6.tar.gz" sha256 "4b16c68c8cfa6aed59bb8ccb16c55ad5b1ec23570695cf7cd335df7c82dbdde2" head "https://github.com/gravitational/teleport.git" bottle do cellar :any_skip_relocation sha256 "2715acb8c04427a786a341624d41b1b35f698274b4e9b46a53b14b03e0fdfac4" => :mojave sha256 "b243dcd3d2ae3bc2bdd5fec30d134815d622ec7e486be412de0d6162e20469db" => :high_sierra sha256 "2732e368c2e1007888b51c4dda315d4bd29f9d29d60ed9a025ae486684e4ed76" => :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