61 lines
1.8 KiB
Ruby
61 lines
1.8 KiB
Ruby
class Glassfish < Formula
|
|
desc "Java EE application server"
|
|
homepage "https://glassfish.org/"
|
|
url "https://download.eclipse.org/ee4j/glassfish/glassfish-7.0.0.zip"
|
|
mirror "https://github.com/eclipse-ee4j/glassfish/releases/download/7.0.0/glassfish-7.0.0.zip"
|
|
sha256 "3bf2140d9cab4dafe773afaf85dd7489c075e8bfb883a95f12d0aa2be306a4e3"
|
|
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 do
|
|
sha256 cellar: :any_skip_relocation, all: "8f56c18877af7bd6d49496282807e73e9efe1dcf795af88d3bfb1d3c3d18fc14"
|
|
end
|
|
|
|
depends_on "openjdk@17"
|
|
|
|
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("17")
|
|
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
|