fortio 0.11.0 (new formula)

Closes #26653.

Signed-off-by: ilovezfs <ilovezfs@icloud.com>
This commit is contained in:
Yossi Mesika 2018-05-23 14:54:03 +03:00 committed by ilovezfs
parent bd779eef02
commit 6707a5b826

38
Formula/fortio.rb Normal file
View file

@ -0,0 +1,38 @@
class Fortio < Formula
desc "HTTP and gRPC load testing and visualization tool and server"
homepage "https://github.com/istio/fortio"
url "https://github.com/istio/fortio.git",
:tag => "v0.11.0",
:revision => "d17e45b4f794ac1722747d7cfbcbe0479722868a"
depends_on "go" => :build
def install
ENV["GOPATH"] = buildpath
(buildpath/"src/istio.io/fortio").install buildpath.children
cd "src/istio.io/fortio" do
date = Time.new.strftime("%Y-%m-%d %H:%M")
system "go", "build", "-a", "-o", bin/"fortio", "-ldflags",
"-s -X istio.io/fortio/ui.resourcesDir=#{lib} " \
"-X istio.io/fortio/version.tag=v#{version} " \
"-X \"istio.io/fortio/version.buildInfo=#{date}\""
lib.install "ui/static", "ui/templates"
prefix.install_metafiles
end
end
test do
assert_match version.to_s, shell_output("#{bin}/fortio version -s")
begin
pid = fork do
exec bin/"fortio", "server", "-http-port", "8080"
end
sleep 2
output = shell_output("#{bin}/fortio load http://localhost:8080/ 2>&1")
assert_match /^All\sdone/, output.lines.last
ensure
Process.kill("SIGTERM", pid)
end
end
end