cask 'squirrelsql' do version '3.7.1' sha256 '4ee542f0fc51489de5c529d242b5731140cb993beeba853ee7675c010cdc81e3' # 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', checkpoint: '2bf738ab989998ed5a58b9239464120247b7adeba9ed3aff1acb9bb7b4113123' name 'SQuirrel SQL' homepage 'http://www.squirrelsql.org/' container type: :naked installoptions = "#{staged_path}/install-options.xml" preflight do # shim script (https://github.com/caskroom/homebrew-cask/issues/18809) File.open(installoptions, 'w') do |f| f.print <<-EOS.undent #{appdir}/SQuirreLSQL.app EOS end end postflight do system_command 'java', args: ['-jar', "#{staged_path}/squirrel-sql-#{version}-MACOSX-install.jar", installoptions.to_s] end uninstall_postflight do system_command 'java', args: ['-jar', "#{appdir}/SQuirreLSQL.app/Uninstaller/uninstaller.jar", '-f', '-c'] end zap delete: '~/.squirrel-sql' caveats do depends_on_java('6+') end end