forked from denisidoro/navi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
brew
executable file
·44 lines (34 loc) · 1.12 KB
/
brew
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
42
43
44
#!/usr/bin/env bash
set -euo pipefail
##? brew formula
export NAVI_HOME="$(cd "$(dirname "$0")/.." && pwd)"
source "${NAVI_HOME}/scripts/install"
gen_formula() {
version="$(latest_version_released)"
header "version: ${version}"
header "sha_for x86_64-unknown-linux-musl..."
sha_linux="$(sha_for_asset_on_github "$version" "x86_64-unknown-linux-musl")"
header "$sha_linux"
header "sha_for x86_64-osx..."
sha_osx="$(sha_for_asset_on_github "$version" "x86_64-osx")"
header "$sha_osx"
header "rb..."
curl -s https://raw.githubusercontent.com/denisidoro/homebrew-tools/master/navi.rb \
| sed -E "s/version ['\"].*/version '${version}'/" \
| awk '!x{x=sub("sha256","sha_osx")}7' \
| awk '!x{x=sub("sha256","sha_linux")}7' \
| sed -E "s/sha_osx.*/sha256 \"${sha_osx}\"/" \
| sed -E "s/sha_linux.*/sha256 \"${sha_linux}\"/"
}
gen_sha() {
version="${1:-$(latest_version_released)}"
header "version: ${version}"
header "sha_for source..."
sha_for_asset_on_github "$version"
}
cmd="$1"
shift
case "$cmd" in
"formula") gen_formula "$@" ;;
"sha") gen_sha "$@" ;;
esac