homebrew-core/Formula/glassfish.rb

59 lines
1.7 KiB
Ruby

class Glassfish < Formula
desc "Java EE application server"
homepage "https://glassfish.org/"
url "https://download.eclipse.org/ee4j/glassfish/glassfish-6.0.0.zip"
mirror "https://github.com/eclipse-ee4j/glassfish/releases/download/6.0.0/glassfish-6.0.0.zip"
sha256 "a528811169e2c97d13618c1985bf6a70160e251b1b8a68bb22d43d9ee367e2e0"
license "EPL-2.0"
livecheck do
url "https://projects.eclipse.org/projects/ee4j.glassfish/downloads"
regex(/href=.*?glassfish[._-]v?(\d+(?:\.\d+)+)\.zip/i)
end
bottle :unneeded
depends_on "openjdk@8"
conflicts_with "payara", because: "both install the same scripts"
def install
# Remove all windows files
rm_rf Dir["bin/*.bat", "glassfish/bin/*.bat"]
libexec.install Dir["*"]
bin.install Dir["#{libexec}/bin/*"]
env = Language::Java.overridable_java_home_env("1.8")
env["GLASSFISH_HOME"] = libexec
bin.env_script_all_files libexec/"bin", env
File.open(libexec/"glassfish/config/asenv.conf", "a") do |file|
file.puts "AS_JAVA=\"#{env[:JAVA_HOME]}\""
end
end
def caveats
<<~EOS
You may want to add the following to your .bash_profile:
export GLASSFISH_HOME=#{opt_libexec}
EOS
end
test do
assert_match version.to_s, shell_output("#{bin}/asadmin version")
port = free_port
cp_r libexec/"glassfish/domains", testpath
inreplace testpath/"domains/domain1/config/domain.xml", "port=\"4848\"", "port=\"#{port}\""
fork do
exec bin/"asadmin", "start-domain", "--domaindir=#{testpath}/domains", "domain1"
end
sleep 60
output = shell_output("curl -s -X GET localhost:#{port}")
assert_match "GlassFish Server", output
end
end