homebrew-core/Formula/teleport.rb

55 lines
2 KiB
Ruby
Raw Normal View History

class Teleport < Formula
desc "Modern SSH server for teams managing distributed infrastructure"
homepage "https://gravitational.com/teleport"
url "https://github.com/gravitational/teleport/archive/v2.0.5.tar.gz"
sha256 "e9a6980d4ac0e570c95ccb36ef0f71462027a53032fa1f9f1c87b5d75bcb13f0"
2017-03-13 20:16:59 +00:00
bottle do
2017-05-03 22:31:11 +00:00
sha256 "ddde4881540e72de7c3d7731b3cf8c7d377e9b3ac1f80e56400d48d24bd582b0" => :sierra
sha256 "3abb1e52385223c369c923f532b26fd94f9512039838f89ba1393d717ce0c6b9" => :el_capitan
sha256 "5533cc345cc02dae2a29e5cc14b372da391ccb0d3998bf06715860589b7e5639" => :yosemite
2017-03-13 20:16:59 +00:00
end
depends_on "go" => :build
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
ln_s buildpath/"src", buildpath / "src/github.com/gravitational/teleport"
cd "src/github.com/gravitational/teleport" do
ENV.deparallelize { system "make", "release" }
system "/usr/bin/tar", "-xvf", "teleport-v#{version}-#{ENV["GOOS"]}-#{ENV["GOARCH"]}-bin.tar.gz"
cd "teleport" do
bin.install %w[teleport tctl tsh]
prefix.install_metafiles
end
end
end
test do
assert_match version.to_s, shell_output("#{bin}/teleport version")
assert_match version.to_s, shell_output("#{bin}/tctl version")
assert_match version.to_s, shell_output("#{bin}/tsh 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