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.10/payara-5.2021.10.zip"
sha256 "fb61921704f577e5a5e0089611ad2885e6fb765c11e9c8a3e0c8df1c741c37a3"
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: "5fd22d147156045db682137c251114e3ca3205ec7dabd411bad1a17498febb55"
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