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.183/payara-5.183.zip" sha256 "2940a780c781643f5bc3044658e935443e5d51d96e2ee62bac4baefa7e6122df" bottle :unneeded depends_on :java => "1.8" 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("1.8")) 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 plist_options :manual => "asadmin start-domain --verbose domain1" def plist; <<~EOS Label #{plist_name} KeepAlive Crashed SuccessfulExit WorkingDirectory #{opt_libexec}/glassfish EnvironmentVariables GLASSFISH_HOME #{opt_libexec}/glassfish ProgramArguments #{opt_libexec}/glassfish/bin/asadmin start-domain --verbose domain1 EOS end test do ENV["GLASSFISH_HOME"] = opt_libexec/"glassfish" output = shell_output("#{bin}/asadmin list-domains") assert_match /^domain1 not running$/, output assert_match /^production not running$/, output assert_match /^Command list-domains executed successfully\.$/, output end end