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.2022.3/payara-5.2022.3.zip"
sha256 "4088221274882de792fda0836ddd47f0550f896e44c62174579c2c70a1177a5d"
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: "cfc75cb33bb606c9ea5490e4fe5385dd2a11537dbe6ede38b2c55ed77c59ccec"
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