homebrew-core/Formula/teleport.rb

65 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/v7.1.0.tar.gz"
sha256 "0b716eb1cd02b1d41c017954c5a173ab5372ab4698276faab6c45e3f2aedaeae"
license "Apache-2.0"
head "https://github.com/gravitational/teleport.git", branch: "master"
# 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
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "ce54e05c99feceedb10e92e20be56e4d54c3800d7814a8dec04843219bbaddcf"
sha256 cellar: :any_skip_relocation, big_sur: "0d5f384bc8b6aae44448810509948bd0c16015e9a7c3c8d075db26b04f134967"
sha256 cellar: :any_skip_relocation, catalina: "b1437b41e39c3de655941fdcadf96fdbed05ad15ca19012baab60f68a8599269"
sha256 cellar: :any_skip_relocation, mojave: "1c47d87520dba62e93784e125ccbcc0fa75dc9c990fcd416e7209d4875797b5d"
sha256 cellar: :any_skip_relocation, x86_64_linux: "50f62a19a3072a427bc70409754be476f2b34e797b2dace0bcaf2f9e732151a4"
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"
# Keep this in sync with https://github.com/gravitational/teleport/tree/v#{version}
resource "webassets" do
url "https://github.com/gravitational/webassets/archive/07493a5e78677de448b0e35bd72bf1dc6498b5ea.tar.gz"
sha256 "2074ee7e50720f20ff1b4da923434c05f6e1664e13694adde9522bf9ab09e0fd"
end
def install
(buildpath/"webassets").install resource("webassets")
ENV.deparallelize { system "make", "full" }
bin.install Dir["build/*"]
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_(.*)/, "")
fork do
exec "#{bin}/teleport start -c #{testpath}/config.yml --debug"
end
sleep 10
system "curl", "--insecure", "https://localhost:3080"
system "nc", "-z", "localhost", "3022"
system "nc", "-z", "localhost", "3023"
system "nc", "-z", "localhost", "3025"
end
end