90 lines
3.2 KiB
Ruby
90 lines
3.2 KiB
Ruby
class WildflyAs < Formula
|
|
desc "Managed application runtime for building applications"
|
|
homepage "https://www.wildfly.org/"
|
|
url "https://github.com/wildfly/wildfly/releases/download/26.1.1.Final/wildfly-26.1.1.Final.tar.gz"
|
|
sha256 "84d4caa31a82ee0dcd14528857c7efa23cef1ba819a981390f0f7587f191d364"
|
|
license "LGPL-2.1-or-later"
|
|
|
|
livecheck do
|
|
url "https://www.wildfly.org/downloads/"
|
|
regex(/href=.*?wildfly[._-]v?(\d+(?:\.\d+)+)\.Final\.t/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "24fba6e0f5201267c78e9ff5768c0968b067edf5afecbfa18507eae9e8fbf23b"
|
|
sha256 cellar: :any, arm64_big_sur: "24fba6e0f5201267c78e9ff5768c0968b067edf5afecbfa18507eae9e8fbf23b"
|
|
sha256 cellar: :any, monterey: "b82ea3020b78c0b58725b74344ea2db49c5997c10e9213d2d163b1ca3538526e"
|
|
sha256 cellar: :any, big_sur: "b82ea3020b78c0b58725b74344ea2db49c5997c10e9213d2d163b1ca3538526e"
|
|
sha256 cellar: :any, catalina: "b82ea3020b78c0b58725b74344ea2db49c5997c10e9213d2d163b1ca3538526e"
|
|
end
|
|
|
|
# Installs a pre-built `libartemis-native-64.so` file with linkage to libaio.so.1
|
|
depends_on :macos
|
|
depends_on "openjdk"
|
|
|
|
def install
|
|
buildpath.glob("bin/*.{bat,ps1}").map(&:unlink)
|
|
buildpath.glob("**/win-x86_64").map(&:rmtree)
|
|
buildpath.glob("**/linux-i686").map(&:rmtree)
|
|
buildpath.glob("**/linux-s390x").map(&:rmtree)
|
|
buildpath.glob("**/linux-x86_64").map(&:rmtree)
|
|
buildpath.glob("**/netty-transport-native-epoll/**/native").map(&:rmtree)
|
|
if Hardware::CPU.intel?
|
|
buildpath.glob("**/*_aarch_64.jnilib").map(&:unlink)
|
|
else
|
|
buildpath.glob("**/macosx-x86_64").map(&:rmtree)
|
|
buildpath.glob("**/*_x86_64.jnilib").map(&:unlink)
|
|
end
|
|
|
|
inreplace "bin/standalone.sh", /JAVA="[^"]*"/, "JAVA='#{Formula["openjdk"].opt_bin}/java'"
|
|
|
|
libexec.install Dir["*"]
|
|
mkdir_p libexec/"standalone/log"
|
|
end
|
|
|
|
def caveats
|
|
<<~EOS
|
|
The home of WildFly Application Server #{version} is:
|
|
#{opt_libexec}
|
|
You may want to add the following to your .bash_profile:
|
|
export JBOSS_HOME=#{opt_libexec}
|
|
export PATH=${PATH}:${JBOSS_HOME}/bin
|
|
EOS
|
|
end
|
|
|
|
service do
|
|
run [opt_libexec/"bin/standalone.sh", "--server-config=standalone.xml"]
|
|
environment_variables JBOSS_HOME: opt_libexec, WILDFLY_HOME: opt_libexec
|
|
keep_alive successful_exit: false, crashed: true
|
|
end
|
|
|
|
test do
|
|
ENV["JBOSS_HOME"] = opt_libexec
|
|
system "#{opt_libexec}/bin/standalone.sh --version | grep #{version}"
|
|
|
|
port = free_port
|
|
|
|
pidfile = testpath/"pidfile"
|
|
ENV["LAUNCH_JBOSS_IN_BACKGROUND"] = "true"
|
|
ENV["JBOSS_PIDFILE"] = pidfile
|
|
|
|
mkdir testpath/"standalone"
|
|
mkdir testpath/"standalone/deployments"
|
|
cp_r libexec/"standalone/configuration", testpath/"standalone"
|
|
fork do
|
|
exec opt_libexec/"bin/standalone.sh", "--server-config=standalone.xml",
|
|
"-Djboss.http.port=#{port}",
|
|
"-Djboss.server.base.dir=#{testpath}/standalone"
|
|
end
|
|
sleep 10
|
|
|
|
begin
|
|
system "curl", "-X", "GET", "localhost:#{port}/"
|
|
output = shell_output("curl -s -X GET localhost:#{port}")
|
|
assert_match "Welcome to WildFly", output
|
|
ensure
|
|
Process.kill "SIGTERM", pidfile.read.to_i
|
|
end
|
|
end
|
|
end
|