homebrew-core/Formula/teleport.rb
2019-11-06 15:01:14 +09:00

51 lines
1.8 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/v4.1.4.tar.gz"
sha256 "8b73986543510bbcb5f3a719f9d9c4e41d8016247a71d7ddac4ac0cf1321c79a"
head "https://github.com/gravitational/teleport.git"
bottle do
cellar :any_skip_relocation
sha256 "f27e360b6a8075ace4fc6d018ddd35f9d44418803ea6c5d881b15e4d123b7c0c" => :catalina
sha256 "a6c5a756cd7835e77852dafe12c852d19a8aa4eaf328b59b5ab18b6981d8e42b" => :mojave
sha256 "0eaf02534b497dc8432acb71c838552c64ecada745838c3d1075eee8923740d7" => :high_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