homebrew-core/Formula/jetty-runner.rb

45 lines
1.3 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.44.v20210927/jetty-runner-9.4.44.v20210927.jar"
version "9.4.44.v20210927"
sha256 "efc948f654bbba3e8578acd8f6d5fd9691e0570abc2e80429e9a1f229a97feb0"
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
rebuild 1
sha256 cellar: :any_skip_relocation, all: "3c98e7c4b36ccd43c5a31c205f76d42b18b3aaa13d154d790300a0e7cb5178d5"
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