cask "squirrelsql" do version "4.8.0" sha256 "2a960a1192bba234defe2fcbf288065094c87ca72edbfa53cbbcd3731e07b1e1" url "https://downloads.sourceforge.net/squirrel-sql/1-stable/#{version}/squirrel-sql-#{version}-MACOSX-install.jar", verified: "sourceforge.net/squirrel-sql/" name "SQuirrel SQL" desc "Graphical Java program for viewing the structure of a JDBC compliant database" homepage "https://squirrel-sql.sourceforge.io/" no_autobump! because: :requires_manual_review container type: :naked installoptions = "#{staged_path}/install-options.xml" preflight do # shim script (https://github.com/Homebrew/homebrew-cask/issues/18809) File.open(installoptions, "w") do |f| f.print <<~EOS #{appdir}/SQuirreLSQL.app EOS end end postflight do system_command "/usr/bin/java", args: ["-jar", "#{staged_path}/squirrel-sql-#{version}-MACOSX-install.jar", installoptions.to_s] end uninstall_preflight do system_command "/usr/bin/java", args: ["-jar", "#{appdir}/SQuirreLSQL.app/Uninstaller/uninstaller.jar", "-f", "-c"] end uninstall delete: "#{appdir}/SQuirreLSQL.app" zap trash: "~/.squirrel-sql" caveats do depends_on_java "11+" end end