8fc2080104
Closes #39000. Signed-off-by: FX Coudert <fxcoudert@gmail.com>
41 lines
1.1 KiB
Ruby
41 lines
1.1 KiB
Ruby
class Jetty < Formula
|
|
desc "Java servlet engine and webserver"
|
|
homepage "https://www.eclipse.org/jetty/"
|
|
url "https://search.maven.org/remotecontent?filepath=org/eclipse/jetty/jetty-distribution/9.4.16.v20190411/jetty-distribution-9.4.16.v20190411.tar.gz"
|
|
version "9.4.16.v20190411"
|
|
sha256 "f8d2e2381a2d71ebd861a0090786ecc473e93aebaa96e7de2de49fcb90a96c6e"
|
|
|
|
bottle :unneeded
|
|
|
|
depends_on :java => "1.8+"
|
|
|
|
def install
|
|
libexec.install Dir["*"]
|
|
(libexec+"logs").mkpath
|
|
|
|
bin.mkpath
|
|
Dir.glob("#{libexec}/bin/*.sh") do |f|
|
|
scriptname = File.basename(f, ".sh")
|
|
(bin+scriptname).write <<~EOS
|
|
#!/bin/bash
|
|
JETTY_HOME=#{libexec}
|
|
#{f} "$@"
|
|
EOS
|
|
chmod 0755, bin+scriptname
|
|
end
|
|
end
|
|
|
|
test do
|
|
ENV["JETTY_BASE"] = testpath
|
|
cp_r Dir[libexec/"*"], testpath
|
|
pid = fork { exec bin/"jetty", "start" }
|
|
sleep 5 # grace time for server start
|
|
begin
|
|
assert_match /Jetty running pid=\d+/, shell_output("#{bin}/jetty check")
|
|
assert_equal "Stopping Jetty: OK\n", shell_output("#{bin}/jetty stop")
|
|
ensure
|
|
Process.kill 9, pid
|
|
Process.wait pid
|
|
end
|
|
end
|
|
end
|