homebrew-core/Formula/jetty-runner.rb

42 lines
1.1 KiB
Ruby

class JettyRunner < Formula
desc "Use Jetty without an installed distribution"
homepage "https://www.eclipse.org/jetty/"
url "https://search.maven.org/remotecontent?filepath=org/eclipse/jetty/jetty-runner/9.4.33.v20201020/jetty-runner-9.4.33.v20201020.jar"
version "9.4.33.v20201020"
sha256 "a56722e79f71caa71a314d18bbb01f513d6e23abab9c08462df6c0f6a40fb5a8"
license any_of: ["Apache-2.0", "EPL-1.0"]
livecheck do
url "https://www.eclipse.org/jetty/download.html"
regex(/href=.*?jetty-distribution[._-]v?(\d+(?:\.\d+)+(?:\.v\d+)?)\.t/i)
end
bottle :unneeded
depends_on "openjdk"
def install
libexec.install Dir["*"]
bin.write_jar_script libexec/"jetty-runner-#{version}.jar", "jetty-runner"
end
test do
ENV.append "_JAVA_OPTIONS", "-Djava.io.tmpdir=#{testpath}"
touch "#{testpath}/test.war"
port = free_port
pid = fork do
exec "#{bin}/jetty-runner --port #{port} test.war"
end
sleep 5
begin
output = shell_output("curl -I http://localhost:#{port}")
assert_match %r{HTTP/1\.1 200 OK}, output
ensure
Process.kill 9, pid
Process.wait pid
end
end
end