forked from Homebrew/homebrew-cask
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbetwixt.rb
41 lines (36 loc) · 1.63 KB
/
betwixt.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
cask 'betwixt' do
version '1.6.1'
sha256 'a97f893e8bc7611dfde66ae75775a829c4d25959b946276aacf32cc8485c4054'
url "https://github.com/kdzwinel/betwixt/releases/download/#{version}/Betwixt-darwin-x64.zip"
appcast 'https://github.com/kdzwinel/betwixt/releases.atom'
name 'Betwixt'
homepage 'https://github.com/kdzwinel/betwixt'
app 'Betwixt-darwin-x64/Betwixt.app'
uninstall_postflight do
cert = "#{ENV['HOME']}/Library/Application Support/betwixt/ssl/certs/ca.pem"
next unless File.exist? cert
stdout, * = system_command '/usr/bin/openssl',
args: [
'x509',
'-fingerprint', '-sha256',
'-noout',
'-in', cert
]
hash = stdout.lines.first.split('=').second.delete(':').strip
stdout, * = system_command '/usr/bin/security',
args: ['find-certificate', '-a', '-c', 'NodeMITMProxyCA', '-Z'],
sudo: true
hashes = stdout.lines.grep(%r{^SHA-256 hash:}) { |l| l.split(':').second.strip }
if hashes.include?(hash)
system_command '/usr/bin/security',
args: ['delete-certificate', '-Z', hash],
sudo: true
end
end
zap trash: [
'~/Library/Application Support/betwixt',
'~/Library/Caches/betwixt',
'~/Library/Preferences/com.electron.betwixt.plist',
'~/Library/Saved Application State/com.electron.betwixt.savedState',
]
end