homebrew-core/Formula/tomcat.rb

68 lines
2.3 KiB
Ruby

class Tomcat < Formula
desc "Implementation of Java Servlet and JavaServer Pages"
homepage "https://tomcat.apache.org/"
stable do
url "https://www.apache.org/dyn/closer.cgi?path=tomcat/tomcat-8/v8.5.5/bin/apache-tomcat-8.5.5.tar.gz"
mirror "https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.5/bin/apache-tomcat-8.5.5.tar.gz"
sha256 "123ba0c010267d54caf984872d3cb449ae29bbd956fa17467185e0c2b3ecae45"
depends_on java: "1.7+"
resource "fulldocs" do
url "https://www.apache.org/dyn/closer.cgi?path=/tomcat/tomcat-8/v8.5.5/bin/apache-tomcat-8.5.5-fulldocs.tar.gz"
mirror "https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.5/bin/apache-tomcat-8.5.5-fulldocs.tar.gz"
version "8.5.5"
sha256 "b87154992b2ecfe3f6d5c113898efee0aec557214ecbd64a38dd5ba2945cb42b"
end
end
devel do
url "https://www.apache.org/dyn/closer.cgi?path=/tomcat/tomcat-9/v9.0.0.M10/bin/apache-tomcat-9.0.0.M10.tar.gz"
mirror "https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.0.M10/bin/apache-tomcat-9.0.0.M10.tar.gz"
version "9.0.0.M10"
sha256 "09bf22df9a5bf7b7b901da751681fb6ad55194f27ac7360e4f79cb9f3ec7775c"
depends_on java: "1.8+"
resource "fulldocs" do
url "https://www.apache.org/dyn/closer.cgi?path=/tomcat/tomcat-9/v9.0.0.M10/bin/apache-tomcat-9.0.0.M10-fulldocs.tar.gz"
mirror "https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.0.M10/bin/apache-tomcat-9.0.0.M10-fulldocs.tar.gz"
version "9.0.0.M10"
sha256 "fa33c02ed8c2b7400c7adaf6b180a3d05dccd196565bda42280a6f0aacc69046"
end
end
bottle :unneeded
option "with-fulldocs", "Install full documentation locally"
def install
# Remove Windows scripts
rm_rf Dir["bin/*.bat"]
# Install files
prefix.install %w[NOTICE LICENSE RELEASE-NOTES RUNNING.txt]
libexec.install Dir["*"]
bin.install_symlink "#{libexec}/bin/catalina.sh" => "catalina"
(share/"fulldocs").install resource("fulldocs") if build.with? "fulldocs"
end
test do
ENV["CATALINA_BASE"] = testpath
cp_r Dir["#{libexec}/*"], testpath
rm Dir["#{libexec}/logs/*"]
pid = fork do
exec bin/"catalina", "start"
end
sleep 3
begin
system bin/"catalina", "stop"
ensure
Process.wait pid
end
File.exist? testpath/"logs/catalina.out"
end
end