49 lines
1.8 KiB
Ruby
49 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/v3.0.1.tar.gz"
|
|
sha256 "621e9281b7851f88a51da5d857c4f1a53b3b7911151a6420d77bbf227f0f573a"
|
|
|
|
bottle do
|
|
sha256 "1bdb2bb7e97862291f12792743102365b1b8b40efd12d43df96f88bb5af0e4c3" => :mojave
|
|
sha256 "a0fa2cf128d526c24fa547f399c83f0481ce04ffcd5c47dfb67e99166ab68660" => :high_sierra
|
|
sha256 "c2667661301acd34d625575055c9a29139262bf17bec531467d807afb005375f" => :sierra
|
|
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
|