-
Notifications
You must be signed in to change notification settings - Fork 7
/
update-formula.fish
31 lines (31 loc) · 998 Bytes
/
update-formula.fish
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
#!/usr/bin/env fish
if test "$argv[1]" = ""
echo Usage:
echo update-formula 3.3
else
set newVersion "$argv[1]"
set newFile "v$newVersion.tar.gz"
echo Trying to download $newFile
wget -nv https://github.com/sbmpost/AutoRaise/archive/refs/tags/$newFile
if test "$status" != 0
echo Fail!
else
echo Succes!\n
echo Calculating sha256..
set sha (shasum -a 256 $newFile | string split " ")[1]
echo $sha\n
rm $newFile
echo Old values:
grep -E 'version |sha256 ' autoraise.rb
echo Replacing with new values..
sed -i '' -e '/version / s/\".*\"/\"'$newVersion'\"/ ; /sha256 / s/\".*\"/\"'$sha'\"/ ;' autoraise.rb
sed -i '' -e '/version / s/\".*\"/\"'$newVersion'\"/ ;' Casks/autoraiseapp.rb
if test "$status" = 0
echo New values:
grep -E 'version |sha256 ' autoraise.rb
echo \nSucces!
else
echo Fail!
end
end
end