phinze/homebrew-cask

View on GitHub
Casks/r/reqable.rb

Summary

Maintainability
A
55 mins
Test Coverage
cask "reqable" do
  arch arm: "arm64", intel: "x86_64"

  version "2.23.0"
  sha256 arm:   "0e44c91f98988f615a8537c1fdf307349f56ff5e489e43b9fb21328941de639a",
         intel: "9e21395e99caf21742dc2248ead4a115dd6a9a0d330c2363fdfbfd1ebf12eb1e"

  url "https://github.com/reqable/reqable-app/releases/download/#{version}/reqable-app-macos-#{arch}.dmg",
      verified: "github.com/reqable/reqable-app/"
  name "Reqable"
  desc "Advanced API Debugging Proxy"
  homepage "https://reqable.com/"

  auto_updates true

  app "Reqable.app"

  uninstall_postflight do
    stdout, * = system_command "/usr/bin/security",
                               args: ["find-certificate", "-a", "-c", "Reqable Proxy", "-Z"],
                               sudo: true
    hashes = stdout.lines.grep(/^SHA-256 hash:/) { |l| l.split(":").second.strip }
    hashes.each do |h|
      system_command "/usr/bin/security",
                     args: ["delete-certificate", "-Z", h],
                     sudo: true
    end
  end

  zap trash: [
    "~/Library/Caches/Reqable",
    "~/Library/Preferences/com.reqable.macosx.plist",
  ]
end