homebrew-core/Formula/payara.rb

59 lines
1.8 KiB
Ruby

class Payara < Formula
desc "Java EE application server forked from GlassFish"
homepage "https://www.payara.fish"
url "https://search.maven.org/remotecontent?filepath=fish/payara/distributions/payara/5.2021.8/payara-5.2021.8.zip"
sha256 "64ebb1ac3507afd4fa6daa2c3735e964889faee816f10c8775ba09e8166c9ce1"
license any_of: [
"CDDL-1.1",
{ "GPL-2.0-only" => { with: "Classpath-exception-2.0" } },
]
livecheck do
url "https://search.maven.org/remotecontent?filepath=fish/payara/distributions/payara/"
regex(%r{href=["']?v?(\d+(?:\.\d+)+)/?["' >]}i)
end
bottle do
sha256 cellar: :any_skip_relocation, all: "6bc43426efc323aeb2117f333e300026631979c60b8854f2b85f97b1bd10e729"
end
depends_on :macos # The test fails on Linux.
depends_on "openjdk@11"
conflicts_with "glassfish", because: "both install the same scripts"
def install
# Remove Windows scripts
rm_f Dir["**/*.{bat,exe}"]
inreplace "bin/asadmin", /AS_INSTALL=.*/,
"AS_INSTALL=#{libexec}/glassfish"
libexec.install Dir["*"]
bin.install Dir["#{libexec}/bin/*"]
bin.env_script_all_files(libexec/"bin", Language::Java.java_home_env("11"))
end
def caveats
<<~EOS
You may want to add the following to your .bash_profile:
export GLASSFISH_HOME=#{opt_libexec}/glassfish
export PATH=${PATH}:${GLASSFISH_HOME}/bin
EOS
end
service do
run [opt_libexec/"glassfish/bin/asadmin", "start-domain", "--verbose", "domain1"]
keep_alive true
working_dir opt_libexec/"glassfish"
environment_variables GLASSFISH_HOME: opt_libexec/"glassfish"
end
test do
ENV["GLASSFISH_HOME"] = opt_libexec/"glassfish"
output = shell_output("#{bin}/asadmin list-domains")
assert_match "domain1 not running", output
assert_match "Command list-domains executed successfully.", output
end
end