class Metabase < Formula desc "Business intelligence report server" homepage "https://www.metabase.com/" url "https://downloads.metabase.com/v0.38.0.1/metabase.jar" sha256 "29c050f188758a9cf3fe84d632f19fbb4d3b6731cc0cc0fb7fe26042ed4d4a2c" license "AGPL-3.0-only" livecheck do url "https://www.metabase.com/start/oss/jar.html" regex(%r{href=.*?/v?(\d+(?:\.\d+)+)/metabase\.jar}i) end head do url "https://github.com/metabase/metabase.git" depends_on "leiningen" => :build depends_on "node" => :build depends_on "yarn" => :build end bottle :unneeded # metabase uses jdk.nashorn.api.scripting.JSObject # which is removed in Java 15 depends_on "openjdk@11" def install if build.head? system "./bin/build" libexec.install "target/uberjar/metabase.jar" else libexec.install "metabase.jar" end bin.write_jar_script libexec/"metabase.jar", "metabase", java_version: "11" end plist_options startup: true, manual: "metabase" def plist <<~EOS KeepAlive Label #{plist_name} ProgramArguments #{opt_bin}/metabase RunAtLoad WorkingDirectory #{var}/metabase StandardOutPath #{var}/metabase/server.log StandardErrorPath /dev/null EOS end test do system bin/"metabase", "migrate", "up" end end