cask "postgres-unofficial" do version "2.6.6,11-12-13-14-15-16" sha256 "3aa9d66e9030d503e687fecd960b493c7ad68c2e0bba7c184175a260639ccb6b" url "https://github.com/PostgresApp/PostgresApp/releases/download/v#{version.csv.first}/Postgres-#{version.csv.first}-#{version.csv.second}.dmg", verified: "github.com/PostgresApp/PostgresApp/" name "Postgres" desc "App wrapper for Postgres" homepage "https://postgresapp.com/" livecheck do url "https://github.com/PostgresApp/PostgresApp/releases/latest" regex(/href=.*?Postgres[._-]v?(\d+(?:\.\d+)+)[._-](\d+(?:-\d+)+)\.dmg/i) strategy :header_match do |headers, regex| next if headers["location"].blank? # Identify the latest tag from the response's `location` header latest_tag = File.basename(headers["location"]) next if latest_tag.blank? # Fetch the assets list HTML for the latest tag and match within it assets_page = Homebrew::Livecheck::Strategy.page_content( @url.sub(%r{/releases/?.+}, "/releases/expanded_assets/#{latest_tag}"), ) assets_page[:content]&.scan(regex)&.map { |match| "#{match[0]},#{match[1]}" } end end auto_updates true depends_on macos: ">= :sierra" app "Postgres.app" uninstall launchctl: "com.postgresapp.Postgres#{version.major}LoginHelper", quit: [ "com.postgresapp.Postgres#{version.major}", "com.postgresapp.Postgres#{version.major}MenuHelper", ] zap trash: [ "~/Library/Application Support/Postgres", "~/Library/Caches/com.postgresapp.Postgres#{version.major}", "~/Library/Cookies/com.postgresapp.Postgres#{version.major}.binarycookies", "~/Library/Preferences/com.postgresapp.Postgres#{version.major}.plist", ] end