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.0.35/bin/apache-tomcat-8.0.35.tar.gz" mirror "https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.35/bin/apache-tomcat-8.0.35.tar.gz" sha256 "6bc380aeebe0b56cf9b37b8c3c128919d2e8ac84d756448fc8e9d8af122f88fd" depends_on :java => "1.7+" resource "fulldocs" do url "https://www.apache.org/dyn/closer.cgi?path=/tomcat/tomcat-8/v8.0.35/bin/apache-tomcat-8.0.35-fulldocs.tar.gz" mirror "https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.35/bin/apache-tomcat-8.0.35-fulldocs.tar.gz" version "8.0.35" sha256 "572e91559b7ade53f69ef5d0277db19717c672963ef10b719b8f4b7cd2c79ccf" end end devel do url "https://www.apache.org/dyn/closer.cgi?path=/tomcat/tomcat-9/v9.0.0.M6/bin/apache-tomcat-9.0.0.M6.tar.gz" version "9.0.0.M6" sha256 "5a58d6454a3ef27a464ab090e82aca7a94f4525524ef4163fa500b9e49d5d42c" depends_on :java => "1.8+" resource "fulldocs" do url "https://www.apache.org/dyn/closer.cgi?path=/tomcat/tomcat-9/v9.0.0.M6/bin/apache-tomcat-9.0.0.M6-fulldocs.tar.gz" version "9.0.0.M6" sha256 "4e34b6255231a052acc31b8d2c4679c5328d9ed8b7be1f28199b5147ad82d9bd" 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