wiremock-standalone 2.18.0 (new formula) (#29201)
This commit is contained in:
parent
e320ef6631
commit
4baf04f09a
1 changed files with 36 additions and 0 deletions
36
Formula/wiremock-standalone.rb
Normal file
36
Formula/wiremock-standalone.rb
Normal file
|
@ -0,0 +1,36 @@
|
|||
class WiremockStandalone < Formula
|
||||
desc "Simulator for HTTP-based APIs"
|
||||
homepage "http://wiremock.org/docs/running-standalone/"
|
||||
url "https://search.maven.org/remotecontent?filepath=com/github/tomakehurst/wiremock-standalone/2.18.0/wiremock-standalone-2.18.0.jar"
|
||||
sha256 "b6ca6b6c9e0dbbf8ec6d6752f93f61beb99325c88fe067377e4250fd390c03c9"
|
||||
|
||||
bottle :unneeded
|
||||
|
||||
depends_on :java => "1.8+"
|
||||
|
||||
def install
|
||||
libexec.install "wiremock-standalone-#{version}.jar"
|
||||
bin.write_jar_script libexec/"wiremock-standalone-#{version}.jar", "wiremock"
|
||||
end
|
||||
|
||||
test do
|
||||
require "socket"
|
||||
|
||||
server = TCPServer.new(0)
|
||||
port = server.addr[1]
|
||||
server.close
|
||||
|
||||
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
|
Loading…
Reference in a new issue