From 50db2638cd8b16d577c1919398176458cdbbb95c Mon Sep 17 00:00:00 2001 From: MoonFruit Date: Mon, 8 Mar 2021 17:35:59 +0800 Subject: [PATCH] tomcat 10.0.2 (new formula) --- Aliases/tomcat@10 | 1 + Formula/tomcat.rb | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 120000 Aliases/tomcat@10 create mode 100644 Formula/tomcat.rb diff --git a/Aliases/tomcat@10 b/Aliases/tomcat@10 new file mode 120000 index 00000000000..0f1c653631c --- /dev/null +++ b/Aliases/tomcat@10 @@ -0,0 +1 @@ +../Formula/tomcat.rb \ No newline at end of file diff --git a/Formula/tomcat.rb b/Formula/tomcat.rb new file mode 100644 index 00000000000..2e484d85e52 --- /dev/null +++ b/Formula/tomcat.rb @@ -0,0 +1,63 @@ +class Tomcat < Formula + desc "Implementation of Java Servlet and JavaServer Pages" + homepage "https://tomcat.apache.org/" + url "https://www.apache.org/dyn/closer.lua?path=tomcat/tomcat-10/v10.0.2/bin/apache-tomcat-10.0.2.tar.gz" + mirror "https://archive.apache.org/dist/tomcat/tomcat-10/v10.0.2/bin/apache-tomcat-10.0.2.tar.gz" + sha256 "f20791fa8354d1517052ef8c3a6a5705dd9a1ebdbdce0affee9e5a6bd7e55ee2" + license "Apache-2.0" + + bottle :unneeded + + depends_on "openjdk" + + 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/"catalina").write_env_script "#{libexec}/bin/catalina.sh", JAVA_HOME: Formula["openjdk"].opt_prefix + end + + plist_options manual: "catalina run" + + def plist + <<~EOS + + + + + Disabled + + Label + #{plist_name} + ProgramArguments + + #{opt_bin}/catalina + run + + KeepAlive + + + + EOS + 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 + assert_predicate testpath/"logs/catalina.out", :exist? + end +end