71 lines
2.6 KiB
Ruby
71 lines
2.6 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/v5.1.0.tar.gz"
|
|
sha256 "3b9a5625ba786c425aa34ecb153e1d1e6e1eca179e63dd1efbe6a5f1b009d9d9"
|
|
license "Apache-2.0"
|
|
head "https://github.com/gravitational/teleport.git"
|
|
|
|
# We check the Git tags instead of using the `GithubLatest` strategy, as the
|
|
# "latest" version can be incorrect. As of writing, two major versions of
|
|
# `teleport` are being maintained side by side and the "latest" tag can point
|
|
# to a release from the older major version.
|
|
livecheck do
|
|
url :stable
|
|
strategy :git
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "35d3e932558d45b596456a470281693afeeaa61ffb5974255a16d79874e2aa81" => :big_sur
|
|
sha256 "6d466b48d274116470d8424ed25a3fe2d260dde46953c1895e1e1b689d7c948c" => :arm64_big_sur
|
|
sha256 "4a5793602fbc72a2b99535f0203b24ee3e2ee8f8598216065d18c7a284a10caf" => :catalina
|
|
sha256 "89357a0db8c72641d2edd8866a5aa1afe62a49ab98404bf2c9b0a6c7cb0c7dba" => :mojave
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
uses_from_macos "curl" => :test
|
|
uses_from_macos "netcat" => :test
|
|
uses_from_macos "zip"
|
|
|
|
conflicts_with "etsh", because: "both install `tsh` binaries"
|
|
|
|
resource "webassets" do
|
|
url "https://github.com/gravitational/webassets/archive/72412062d6d55ec7faa9707abf500d703e7d09da.tar.gz"
|
|
sha256 "c84767bea0a723f406e3b6566a0a48892758b2e5f3a9e9b453d22171315fd29d"
|
|
end
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
ENV["GOROOT"] = Formula["go"].opt_libexec
|
|
|
|
(buildpath/"webassets").install resource("webassets")
|
|
(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/*"]
|
|
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
|