homebrew-core/Formula/teleport.rb
2018-03-14 16:52:22 +01:00

52 lines
1.9 KiB
Ruby

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.0.tar.gz"
sha256 "743eb30e7c6da5c6d049db73607de84e0ae08ca4483119303f2a48d52c180b96"
bottle do
sha256 "f1ad2846acae8bda561bf5abba0377e61d86b2a131d33fe284dd54a0d1346929" => :high_sierra
sha256 "d952e15a128ac12da2ec0086178b9d5edc199fa3fd82d76a4fc2653367ca6575" => :sierra
sha256 "3aa6f1fdc1b786465a8e8b0166a24e92893010dc0113dd37a4b65906bea8e414" => :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