homebrew-core/Formula/teleport.rb
2019-06-18 08:57:30 +02: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.0.0.tar.gz"
sha256 "64d652a37a652a9e143bc554645a89fed0f30424833bf2ebdc47da61ff50fb42"
head "https://github.com/gravitational/teleport.git"
bottle do
cellar :any_skip_relocation
sha256 "798868cfa5f17c7bb1130a010770117070284c4003f8af54ee207f817ded505e" => :mojave
sha256 "748a1a1b91d3d550fe6c26ab9886045b12f0a85481c8b326bd8c059cc488ca31" => :high_sierra
sha256 "36817f44ec7097a92a078993d6d6a5c008352bfc8f953bee9c4177c7c3fc5fe3" => :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