homebrew-core/Formula/tomcat@9.rb

65 lines
1.5 KiB
Ruby

class TomcatAT9 < 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-9/v9.0.56/bin/apache-tomcat-9.0.56.tar.gz"
mirror "https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.56/bin/apache-tomcat-9.0.56.tar.gz"
sha256 "960ce89fa93099a412f7d1b828d6d97465d5e11500247e9c58a637fded523e0d"
license "Apache-2.0"
revision 1
livecheck do
url :stable
end
bottle do
sha256 cellar: :any_skip_relocation, all: "a6d2ca07390ee95d5fa66401fcfd6b37b0029d628f3202cf2210ed5dd3e6aaf4"
end
keg_only :versioned_formula
depends_on "openjdk"
def install
# Remove Windows scripts
rm_rf Dir["bin/*.bat"]
# Install files
prefix.install %w[NOTICE LICENSE RELEASE-NOTES RUNNING.txt]
pkgetc.install Dir["conf/*"]
(buildpath/"conf").rmdir
libexec.install_symlink pkgetc => "conf"
libexec.install Dir["*"]
(bin/"catalina").write_env_script "#{libexec}/bin/catalina.sh", Language::Java.overridable_java_home_env
end
def caveats
<<~EOS
Configuration files: #{pkgetc}
EOS
end
service do
run [opt_bin/"catalina", "run"]
keep_alive true
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