2020-03-04 21:01:23 +00:00
|
|
|
#!/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}"
|
|
|
|
|
2020-03-05 18:06:31 +00:00
|
|
|
header "sha_for x86_64-unknown-linux-musl..."
|
|
|
|
sha_linux="$(sha_for_asset_on_github "$version" "x86_64-unknown-linux-musl")"
|
2020-03-04 21:01:23 +00:00
|
|
|
|
2020-03-05 18:06:31 +00:00
|
|
|
header "sha_for x86_64-osx..."
|
|
|
|
sha_osx="$(sha_for_asset_on_github "$version" "x86_64-osx")"
|
2020-03-04 21:01:23 +00:00
|
|
|
|
|
|
|
header "rb..."
|
|
|
|
curl -s https://raw.githubusercontent.com/denisidoro/homebrew-tools/master/navirs.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}\"/"
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd="$1"
|
|
|
|
shift
|
|
|
|
|
|
|
|
case "$cmd" in
|
|
|
|
"formula") gen_formula "$@" ;;
|
|
|
|
esac
|