homebrew-core/Formula/jetty-runner.rb

44 lines
1.2 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.50.v20221201/jetty-runner-9.4.50.v20221201.jar"
version "9.4.50.v20221201"
sha256 "5c614f4769154ee8330a2d355670259f73dce58ef63b6e630cf043616561f44a"
license any_of: ["Apache-2.0", "EPL-1.0"]
livecheck do
url "https://www.eclipse.org/jetty/download.php"
regex(/href=.*?jetty-distribution[._-]v?(\d+(?:\.\d+)+(?:\.v\d+)?)\.t/i)
end
bottle do
sha256 cellar: :any_skip_relocation, all: "b9f25d49abbbe28850ee767e1777521ba5454fe502523bc8161314ef53266d82"
end
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 10
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