-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhack
executable file
·41 lines (35 loc) · 1006 Bytes
/
hack
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
#!/usr/bin/env ruby
# frozen_string_literal: true
ver = ARGV[0]
p ver
static_mac_x86 = "https://github.com/CrunchyData/bridge-cli/releases/download/v#{ver}/cb-v#{ver}_macos_amd64.zip"
bottle_mac_x86 = "https://github.com/CrunchyData/homebrew-brew/releases/download/cb-#{ver}/cb-#{ver}.monterey.bottle.tar.gz"
module Ok
def `(cmd)
puts cmd
super
end
end
# include Ok
`rm -rf scratch`
`mkdir -p scratch`
Dir.chdir "scratch"
`curl -L #{static_mac_x86} > static.zip`
`curl -L #{bottle_mac_x86} > bottle.tgz`
`unzip -o static.zip`
`rm static.zip`
`mv cb binary`
`tar xzvf bottle.tgz`
`rm bottle.tgz`
`rm -rf cb/#{ver}/bin/cb`
`mv binary cb/#{ver}/bin/cb`
`chmod -w cb/#{ver}/bin/cb`
`tar cvzf cb-#{ver}.arm64_monterey.bottle.tar.gz cb`
`rm -rf cb`
sha = `shasum -a 256 cb-#{ver}.arm64_monterey.bottle.tar.gz`.split.first
Dir.chdir ".."
`sed -i '' '10i\\ \
sha256 cellar: :any, arm64_monterey: "#{sha}"
' Formula/cb.rb`
p `brew style --fix Formula/cb.rb`
p `brew audit --formula Formula/cb.rb`