mas/script/brew_formula_update

57 lines
1.3 KiB
Text
Raw Normal View History

2019-03-31 22:50:25 +00:00
#!/bin/bash -e
#
2019-04-01 03:05:13 +00:00
# script/brew_formula_update
2019-03-31 22:50:25 +00:00
# mas
#
# Updates mas Homebrew core formula:
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/mas.rb
#
BREW_CORE_PATH="$(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula"
2019-03-31 22:50:25 +00:00
function usage {
echo "Usage: brew_formula_bump [v1.0] [sha1_hash]"
echo "- version will be inferred using version script if not provided"
echo "- sha will be inferred from the curreent commit if not provided"
exit 1
}
# arg 1 - version tag
if test -n "$1"; then
VERSION="$1"
else
VERSION="v$(script/version)"
fi
# arg 2 - revision (commit hash)
if test -n "$2"; then
REVISION="$2"
else
REVISION=$(git rev-parse HEAD)
fi
echo "Checking to see if this update can be a simple bump."
if ! diff "Homebrew/mas.rb" "$BREW_CORE_PATH/mas.rb"; then
echo "There are changes in the local formula (Homebrew/mas.rb) that haven't been released yet."
exit 1
fi
2019-03-31 22:50:25 +00:00
echo "==> 🧪 Updating homebrew-core formula mas ($VERSION, $REVISION)"
echo "Validating formula"
brew bump-formula-pr \
--tag="$VERSION" \
--revision="$REVISION" \
--strict \
mas
pushd "$BREW_CORE_PATH"
2019-03-31 22:50:25 +00:00
echo "Updating formula"
brew bump-formula-pr \
--tag="$VERSION" \
--revision="$REVISION" \
--strict \
--verbose \
mas