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.7.4.tar.gz" sha256 "c4fdccde77445ea0d2257c6a1a968705194e66481832d9c3954fb584d38a4296" bottle do sha256 "e245a930a88014834bc9a31959a01b80a9826f77fa6c0ede2854c51c2a5b489e" => :mojave sha256 "5b43fafeb907ba25414cea0e000cd61798a6be843dc8e3fe49fe8baa76f90eed" => :high_sierra sha256 "a221894085fdc6a93777e4bd565eb91a17a11ccb97a58d1266c8279c76a72604" => :sierra sha256 "928c2a998495b42e92497eb723ad149c075b33d461277851367136ac3ff29184" => :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 (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