37 lines
1.1 KiB
Ruby
37 lines
1.1 KiB
Ruby
class WiremockStandalone < Formula
|
|
desc "Simulator for HTTP-based APIs"
|
|
homepage "https://wiremock.org/docs/running-standalone/"
|
|
url "https://search.maven.org/remotecontent?filepath=com/github/tomakehurst/wiremock-jre8-standalone/2.35.0/wiremock-jre8-standalone-2.35.0.jar"
|
|
sha256 "ae156ae2812e3cfa470c47ed073100ef4ec77927372a4e203f0e3bd531f3eb57"
|
|
license "Apache-2.0"
|
|
head "https://github.com/tomakehurst/wiremock.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, all: "cf5d7cfa1ff79a55030816f8569480bbedb6221bb0f7900525d29b3793c4c4d9"
|
|
end
|
|
|
|
depends_on "openjdk"
|
|
|
|
def install
|
|
libexec.install "wiremock-jre8-standalone-#{version}.jar"
|
|
bin.write_jar_script libexec/"wiremock-jre8-standalone-#{version}.jar", "wiremock"
|
|
end
|
|
|
|
test do
|
|
port = free_port
|
|
|
|
wiremock = fork do
|
|
exec "#{bin}/wiremock", "-port", port.to_s
|
|
end
|
|
|
|
loop do
|
|
Utils.popen_read("curl", "-s", "http://localhost:#{port}/__admin/", "-X", "GET")
|
|
break if $CHILD_STATUS.exitstatus.zero?
|
|
end
|
|
|
|
system "curl", "-s", "http://localhost:#{port}/__admin/shutdown", "-X", "POST"
|
|
|
|
Process.wait(wiremock)
|
|
end
|
|
end
|