cask "squirrelsql" do version "4.1.0" sha256 "ab49aeb1f57ef857202972102e3d7cebe5f52d531a0198c193c4ecc782d9c2e8" # sourceforge.net/squirrel-sql/ was verified as official when first introduced to the cask url "https://downloads.sourceforge.net/squirrel-sql/1-stable/#{version}/squirrel-sql-#{version}-MACOSX-install.jar" appcast "https://sourceforge.net/projects/squirrel-sql/rss?path=/1-stable" name "SQuirrel SQL" homepage "http://www.squirrelsql.org/" 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 "8+" end end