homebrew-core/Formula/teleport.rb
2020-01-17 15:19:09 +01:00

52 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.2.1.tar.gz"
sha256 "e9c515bd3dd5e85578d8f021b648d9ba008fecf4617a0bdab6190ee896d9cc2d"
head "https://github.com/gravitational/teleport.git"
bottle do
cellar :any_skip_relocation
rebuild 1
sha256 "2e9c4f231b3d6dd31b4e817d8e7c063228d2e2ab60ccc2298dacc8fdd2149be3" => :catalina
sha256 "5e0f3f443d7ea4263f3c4c4380ce4c1e08380c1e164fafb1110a6f3a931f4c5e" => :mojave
sha256 "9a1f3cc349b73c270eaed8a721cf30a935d61e25144a94afe870948845343114" => :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