mirror of
https://github.com/mas-cli/mas
synced 2024-11-22 03:23:08 +00:00
Use double quotes around bash substitutions.
Use braces around bash variable uses. Partial #638 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
parent
5b96b77e22
commit
f1a9cde9fd
16 changed files with 73 additions and 73 deletions
16
.github/workflows/release.yml
vendored
16
.github/workflows/release.yml
vendored
|
@ -43,7 +43,7 @@ jobs:
|
||||||
|
|
||||||
- id: pre_release
|
- id: pre_release
|
||||||
run: |
|
run: |
|
||||||
echo "PRE_RELEASE=$(grep -q '-' <<<$MAS_VERSION && echo 'true' || echo 'false')" >>"$GITHUB_OUTPUT"
|
echo "PRE_RELEASE=$(grep -q '-' <<<"${MAS_VERSION}" && echo 'true' || echo 'false')" >>"${GITHUB_OUTPUT}"
|
||||||
|
|
||||||
- id: release_branch
|
- id: release_branch
|
||||||
run: |
|
run: |
|
||||||
|
@ -129,7 +129,7 @@ jobs:
|
||||||
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
|
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
|
||||||
if: ${{ needs.start.outputs.dry_run == 'false' }}
|
if: ${{ needs.start.outputs.dry_run == 'false' }}
|
||||||
run: |
|
run: |
|
||||||
gh release upload ${MAS_VERSION} \
|
gh release upload "${MAS_VERSION}" \
|
||||||
.build/mas.pkg
|
.build/mas.pkg
|
||||||
|
|
||||||
homebrew-tap:
|
homebrew-tap:
|
||||||
|
@ -187,7 +187,7 @@ jobs:
|
||||||
git switch "${RELEASE_BRANCH}"
|
git switch "${RELEASE_BRANCH}"
|
||||||
|
|
||||||
cp -v \
|
cp -v \
|
||||||
${GITHUB_WORKSPACE}/Homebrew/mas-tap.rb \
|
"${GITHUB_WORKSPACE}/Homebrew/mas-tap.rb" \
|
||||||
Formula/mas.rb
|
Formula/mas.rb
|
||||||
|
|
||||||
git add Formula/mas.rb
|
git add Formula/mas.rb
|
||||||
|
@ -210,8 +210,8 @@ jobs:
|
||||||
DRY_RUN: ${{ needs.start.outputs.dry_run }}
|
DRY_RUN: ${{ needs.start.outputs.dry_run }}
|
||||||
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
|
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
|
||||||
run: |
|
run: |
|
||||||
DRY_RUN=${DRY_RUN} \
|
DRY_RUN="${DRY_RUN}" \
|
||||||
script/brew_tap_update ${MAS_VERSION}
|
script/brew_tap_update "${MAS_VERSION}"
|
||||||
|
|
||||||
- name: 🚀 Upload Bottles
|
- name: 🚀 Upload Bottles
|
||||||
env:
|
env:
|
||||||
|
@ -220,7 +220,7 @@ jobs:
|
||||||
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
|
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
|
||||||
if: ${{ needs.start.outputs.dry_run == 'false' }}
|
if: ${{ needs.start.outputs.dry_run == 'false' }}
|
||||||
run: |
|
run: |
|
||||||
gh release upload ${MAS_VERSION} \
|
gh release upload "${MAS_VERSION}" \
|
||||||
.build/bottles/mas-*.bottle.tar.gz
|
.build/bottles/mas-*.bottle.tar.gz
|
||||||
|
|
||||||
homebrew-core:
|
homebrew-core:
|
||||||
|
@ -250,5 +250,5 @@ jobs:
|
||||||
DRY_RUN: ${{ needs.start.outputs.dry_run }}
|
DRY_RUN: ${{ needs.start.outputs.dry_run }}
|
||||||
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
|
MAS_VERSION: ${{ needs.start.outputs.mas_version }}
|
||||||
run: |
|
run: |
|
||||||
DRY_RUN=${DRY_RUN} \
|
DRY_RUN="${DRY_RUN}" \
|
||||||
script/brew_core_update ${MAS_VERSION}
|
script/brew_core_update "${MAS_VERSION}"
|
||||||
|
|
|
@ -8,8 +8,8 @@ _mas() {
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
_get_comp_words_by_ref cur prev words cword
|
_get_comp_words_by_ref cur prev words cword
|
||||||
fi
|
fi
|
||||||
if [[ $cword -eq 1 ]]; then
|
if [[ "${cword}" -eq 1 ]]; then
|
||||||
COMPREPLY=($(compgen -W "$(mas help | tail -n +3 | awk '{print $1}')" -- "$cur"))
|
COMPREPLY=($(compgen -W "$(mas help | tail -n +3 | awk '{print $1}')" -- "${cur}"))
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
function __fish_mas_list_available -d "Lists applications available to install from the Mac App Store"
|
function __fish_mas_list_available -d "Lists applications available to install from the Mac App Store"
|
||||||
set query (commandline -ct)
|
set query (commandline -ct)
|
||||||
if set results (command mas search $query 2>/dev/null)
|
if set results (command mas search "${query}" 2>/dev/null)
|
||||||
for res in $results
|
for res in ${results}
|
||||||
echo $res
|
echo "${res}"
|
||||||
end | string trim --left | string replace -r '\s+' '\t'
|
end | string trim --left | string replace -r '\s+' '\t'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
BUILD_DIR="${PWD}/.build"
|
BUILD_DIR="${PWD}/.build"
|
||||||
BOTTLE_DIR="${BUILD_DIR}/bottles"
|
BOTTLE_DIR="${BUILD_DIR}/bottles"
|
||||||
CORE_TAP_PATH="$(brew --repo homebrew/core)"
|
CORE_TAP_PATH="$(brew --repo homebrew/core)"
|
||||||
MAS_VERSION=$(script/version)
|
MAS_VERSION="$(script/version)"
|
||||||
ROOT_URL="https://github.com/mas-cli/mas/releases/download/v${MAS_VERSION}"
|
ROOT_URL="https://github.com/mas-cli/mas/releases/download/v${MAS_VERSION}"
|
||||||
|
|
||||||
# Supports macOS 10.13 and later
|
# Supports macOS 10.13 and later
|
||||||
|
@ -41,8 +41,8 @@ OS_NAMES=(
|
||||||
|
|
||||||
# Semantic version number split into a list using ugly, bash 3 compatible syntax
|
# Semantic version number split into a list using ugly, bash 3 compatible syntax
|
||||||
IFS=" " read -r -a CURRENT_OS_VERSION <<<"$(sw_vers -productVersion | sed 's/\./ /g')"
|
IFS=" " read -r -a CURRENT_OS_VERSION <<<"$(sw_vers -productVersion | sed 's/\./ /g')"
|
||||||
CURRENT_OS_VERSION_MAJOR=${CURRENT_OS_VERSION[0]}
|
CURRENT_OS_VERSION_MAJOR="${CURRENT_OS_VERSION[0]}"
|
||||||
CURRENT_OS_VERSION_MINOR=${CURRENT_OS_VERSION[1]}
|
CURRENT_OS_VERSION_MINOR="${CURRENT_OS_VERSION[1]}"
|
||||||
|
|
||||||
echo "CURRENT_OS_VERSION_MAJOR: ${CURRENT_OS_VERSION_MAJOR}"
|
echo "CURRENT_OS_VERSION_MAJOR: ${CURRENT_OS_VERSION_MAJOR}"
|
||||||
echo "CURRENT_OS_VERSION_MINOR: ${CURRENT_OS_VERSION_MINOR}"
|
echo "CURRENT_OS_VERSION_MINOR: ${CURRENT_OS_VERSION_MINOR}"
|
||||||
|
@ -121,17 +121,17 @@ if ! test -e "${OLD_FILENAME}"; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SHA256=$(shasum -a 256 "${OLD_FILENAME}" | cut -f 1 -d ' ' -)
|
SHA256="$(shasum -a 256 "${OLD_FILENAME}" | cut -f 1 -d ' ' -)"
|
||||||
|
|
||||||
mkdir -p "${BOTTLE_DIR}"
|
mkdir -p "${BOTTLE_DIR}"
|
||||||
|
|
||||||
# Start of bottle block
|
# Start of bottle block
|
||||||
BOTTLE_BLOCK=$(
|
BOTTLE_BLOCK="$(
|
||||||
cat <<-EOF
|
cat <<-EOF
|
||||||
bottle do
|
bottle do
|
||||||
root_url "${ROOT_URL}"
|
root_url "${ROOT_URL}"
|
||||||
EOF
|
EOF
|
||||||
)
|
)"
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
|
@ -145,21 +145,21 @@ for os in "${OS_NAMES[@]}"; do
|
||||||
|
|
||||||
# Append each os
|
# Append each os
|
||||||
# BOTTLE_BLOCK="$(printf "${BOTTLE_BLOCK}\n sha256 cellar: :any_skip_relocation, %-15s %s" "${os}:" "${SHA256}")"
|
# BOTTLE_BLOCK="$(printf "${BOTTLE_BLOCK}\n sha256 cellar: :any_skip_relocation, %-15s %s" "${os}:" "${SHA256}")"
|
||||||
BOTTLE_BLOCK="${BOTTLE_BLOCK}"$(
|
BOTTLE_BLOCK="${BOTTLE_BLOCK}$(
|
||||||
cat <<-EOF
|
cat <<-EOF
|
||||||
|
|
||||||
sha256 cellar: :any_skip_relocation, ${os}: "${SHA256}"
|
sha256 cellar: :any_skip_relocation, ${os}: "${SHA256}"
|
||||||
EOF
|
EOF
|
||||||
)
|
)"
|
||||||
done
|
done
|
||||||
|
|
||||||
# End of bottle block
|
# End of bottle block
|
||||||
BOTTLE_BLOCK=$(
|
BOTTLE_BLOCK="$(
|
||||||
cat <<-EOF
|
cat <<-EOF
|
||||||
|
|
||||||
end
|
end
|
||||||
EOF
|
EOF
|
||||||
)
|
)"
|
||||||
|
|
||||||
rm "${OLD_FILENAME}"
|
rm "${OLD_FILENAME}"
|
||||||
ls -l "${BOTTLE_DIR}"
|
ls -l "${BOTTLE_DIR}"
|
||||||
|
|
|
@ -24,7 +24,7 @@ function usage {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Max 3 arguments
|
# Max 3 arguments
|
||||||
if [[ $# -gt 3 ]]; then
|
if [[ "${#}" -gt 3 ]]; then
|
||||||
usage 1>&2
|
usage 1>&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -41,11 +41,11 @@ while getopts "d" o; do
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $((OPTIND - 1))
|
shift "$((OPTIND - 1))"
|
||||||
|
|
||||||
# DRY_RUN environment variable
|
# DRY_RUN environment variable
|
||||||
# shellcheck disable=SC2153
|
# shellcheck disable=SC2153
|
||||||
if [[ $DRY_RUN == 'true' ]]; then
|
if [[ "${DRY_RUN}" == 'true' ]]; then
|
||||||
dry_run='-d'
|
dry_run='-d'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ if [[ -n "${2}" ]]; then
|
||||||
REVISION="${2}"
|
REVISION="${2}"
|
||||||
else
|
else
|
||||||
# Derive revision from version. Fails if MAS_VERSION is not a tag.
|
# Derive revision from version. Fails if MAS_VERSION is not a tag.
|
||||||
REVISION=$(git rev-parse "${MAS_VERSION}")
|
REVISION="$(git rev-parse "${MAS_VERSION}")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "REVISION: ${REVISION}"
|
echo "REVISION: ${REVISION}"
|
||||||
|
@ -139,13 +139,13 @@ brew bump-formula-pr \
|
||||||
mas
|
mas
|
||||||
|
|
||||||
# brew exit status
|
# brew exit status
|
||||||
status=$?
|
status="${?}"
|
||||||
if [[ ${status} -ne 0 ]]; then
|
if [[ "${status}" -ne 0 ]]; then
|
||||||
echo "Formula did not validate using 'brew bump-formula-pr'" 1>&2
|
echo "Formula did not validate using 'brew bump-formula-pr'" 1>&2
|
||||||
exit ${status}
|
exit "${status}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $dry_run == '-d' ]]; then
|
if [[ "${dry_run}" == '-d' ]]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ function usage {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Max 2 arguments
|
# Max 2 arguments
|
||||||
if [[ $# -gt 2 ]]; then
|
if [[ "${#}" -gt 2 ]]; then
|
||||||
usage 1>&2
|
usage 1>&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ if [[ -n "${2}" ]]; then
|
||||||
REVISION="${2}"
|
REVISION="${2}"
|
||||||
else
|
else
|
||||||
# Derive revision from version. Fails if MAS_VERSION is not a tag.
|
# Derive revision from version. Fails if MAS_VERSION is not a tag.
|
||||||
REVISION=$(git rev-parse "${MAS_VERSION}")
|
REVISION="$(git rev-parse "${MAS_VERSION}")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "REVISION: ${REVISION}"
|
echo "REVISION: ${REVISION}"
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
# Runs all related scripts for generating all artifacts.
|
# Runs all related scripts for generating all artifacts.
|
||||||
#
|
#
|
||||||
|
|
||||||
MAS_VERSION=$(script/version)
|
MAS_VERSION="$(script/version)"
|
||||||
|
|
||||||
echo "Building mas $MAS_VERSION artifacts"
|
echo "Building mas ${MAS_VERSION} artifacts"
|
||||||
|
|
||||||
script/clean
|
script/clean
|
||||||
script/build --universal
|
script/build --universal
|
||||||
|
|
|
@ -20,7 +20,7 @@ fi
|
||||||
printf $'==> 🚨 Formatting mas\n'
|
printf $'==> 🚨 Formatting mas\n'
|
||||||
|
|
||||||
for LINTER in markdownlint prettier shfmt swift-format swiftformat swiftlint yamllint; do
|
for LINTER in markdownlint prettier shfmt swift-format swiftformat swiftlint yamllint; do
|
||||||
if [[ ! -x "$(command -v ${LINTER})" ]]; then
|
if [[ ! -x "$(command -v "${LINTER}")" ]]; then
|
||||||
printf $'error: %s is not installed. Run \'script/bootstrap\' or \'brew install %s\'.\n' "${LINTER}" "${LINTER}"
|
printf $'error: %s is not installed. Run \'script/bootstrap\' or \'brew install %s\'.\n' "${LINTER}" "${LINTER}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -10,24 +10,24 @@
|
||||||
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/m/mas.rb
|
# https://github.com/Homebrew/homebrew-core/blob/master/Formula/m/mas.rb
|
||||||
#
|
#
|
||||||
|
|
||||||
ARCH=$(uname -m)
|
ARCH="$(uname -m)"
|
||||||
RELEASE=.build/${ARCH}-apple-macosx/release
|
RELEASE=".build/${ARCH}-apple-macosx/release"
|
||||||
MAS_VERSION=$(script/version)
|
MAS_VERSION="$(script/version)"
|
||||||
PREFIX=/usr/local
|
PREFIX=/usr/local
|
||||||
|
|
||||||
while test -n "$1"; do
|
while test -n "${1}"; do
|
||||||
if [[ "$1" == '--universal' ]]; then
|
if [[ "${1}" == '--universal' ]]; then
|
||||||
ARCH=universal
|
ARCH=universal
|
||||||
RELEASE=.build/release
|
RELEASE=.build/release
|
||||||
else
|
else
|
||||||
# Override default prefix path with optional arg
|
# Override default prefix path with optional arg
|
||||||
PREFIX="$1"
|
PREFIX="${1}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "==> 📲 Installing mas ($MAS_VERSION) for $ARCH to $PREFIX"
|
echo "==> 📲 Installing mas (${MAS_VERSION}) for ${ARCH} to ${PREFIX}"
|
||||||
ditto -v \
|
ditto -v \
|
||||||
"$RELEASE/mas" \
|
"${RELEASE}/mas" \
|
||||||
"$PREFIX/bin/mas"
|
"${PREFIX}/bin/mas"
|
||||||
|
|
|
@ -22,7 +22,7 @@ fi
|
||||||
printf $'==> 🚨 Linting mas (%s)\n' "$(script/version --write)"
|
printf $'==> 🚨 Linting mas (%s)\n' "$(script/version --write)"
|
||||||
|
|
||||||
for linter in git markdownlint periphery shellcheck shfmt swift-format swiftformat swiftlint yamllint; do
|
for linter in git markdownlint periphery shellcheck shfmt swift-format swiftformat swiftlint yamllint; do
|
||||||
if [[ ! -x "$(command -v ${linter})" ]]; then
|
if [[ ! -x "$(command -v "${linter}")" ]]; then
|
||||||
printf $'error: %s is not installed. Run \'script/bootstrap\' or \'brew install %s\'.\n' "${linter}" "${linter}"
|
printf $'error: %s is not installed. Run \'script/bootstrap\' or \'brew install %s\'.\n' "${linter}" "${linter}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
# Builds macOS installer component and distribution packages.
|
# Builds macOS installer component and distribution packages.
|
||||||
#
|
#
|
||||||
|
|
||||||
BUILD_DIR="$PWD/.build"
|
BUILD_DIR="${PWD}/.build"
|
||||||
COMPONENT_PACKAGE="$BUILD_DIR/mas_components.pkg"
|
COMPONENT_PACKAGE="${BUILD_DIR}/mas_components.pkg"
|
||||||
DISTRIBUTION_PACKAGE="$BUILD_DIR/mas.pkg"
|
DISTRIBUTION_PACKAGE="${BUILD_DIR}/mas.pkg"
|
||||||
|
|
||||||
IDENTIFIER="com.mphys.mas-cli"
|
IDENTIFIER="com.mphys.mas-cli"
|
||||||
|
|
||||||
|
@ -18,26 +18,26 @@ DISTRIBUTION_PLIST="Package/Distribution.plist"
|
||||||
|
|
||||||
# Destination for install root
|
# Destination for install root
|
||||||
DSTROOT=.build/distributions
|
DSTROOT=.build/distributions
|
||||||
script/install "$DSTROOT/usr/local" --universal
|
script/install "${DSTROOT}/usr/local" --universal
|
||||||
|
|
||||||
MAS_VERSION=$(script/version)
|
MAS_VERSION="$(script/version)"
|
||||||
|
|
||||||
echo "==> 📦 Assemble an installer package"
|
echo "==> 📦 Assemble an installer package"
|
||||||
|
|
||||||
# Assemble macOS installer component package (aka "product archive").
|
# Assemble macOS installer component package (aka "product archive").
|
||||||
pkgbuild \
|
pkgbuild \
|
||||||
--identifier "$IDENTIFIER" \
|
--identifier "${IDENTIFIER}" \
|
||||||
--install-location "/" \
|
--install-location "/" \
|
||||||
--version "$MAS_VERSION" \
|
--version "${MAS_VERSION}" \
|
||||||
--root "$DSTROOT" \
|
--root "${DSTROOT}" \
|
||||||
"$COMPONENT_PACKAGE"
|
"${COMPONENT_PACKAGE}"
|
||||||
|
|
||||||
# Build distribution package (aka "product archive"). Not sure why, but this is how Carthage does it.
|
# Build distribution package (aka "product archive"). Not sure why, but this is how Carthage does it.
|
||||||
# https://github.com/Carthage/Carthage/blob/master/Makefile#L69
|
# https://github.com/Carthage/Carthage/blob/master/Makefile#L69
|
||||||
productbuild \
|
productbuild \
|
||||||
--distribution "$DISTRIBUTION_PLIST" \
|
--distribution "${DISTRIBUTION_PLIST}" \
|
||||||
--package-path "$BUILD_DIR" \
|
--package-path "${BUILD_DIR}" \
|
||||||
"$DISTRIBUTION_PACKAGE"
|
"${DISTRIBUTION_PACKAGE}"
|
||||||
|
|
||||||
echo "==> 🔢 File Hash"
|
echo "==> 🔢 File Hash"
|
||||||
shasum -a 256 "$DISTRIBUTION_PACKAGE"
|
shasum -a 256 "${DISTRIBUTION_PACKAGE}"
|
||||||
|
|
|
@ -14,6 +14,6 @@ sudo installer \
|
||||||
-pkg .build/mas.pkg \
|
-pkg .build/mas.pkg \
|
||||||
-target /
|
-target /
|
||||||
|
|
||||||
pkgutil --pkg-info "$IDENTIFIER"
|
pkgutil --pkg-info "${IDENTIFIER}"
|
||||||
|
|
||||||
pkgutil --files "$IDENTIFIER"
|
pkgutil --files "${IDENTIFIER}"
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
# Override default prefix path with optional 1st arg
|
# Override default prefix path with optional 1st arg
|
||||||
if test -n "$1"; then
|
if test -n "${1}"; then
|
||||||
PREFIX="$1"
|
PREFIX="${1}"
|
||||||
else
|
else
|
||||||
PREFIX=$(brew --prefix)
|
PREFIX="$(brew --prefix)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "==> 🔥 Uninstalling mas from $PREFIX"
|
echo "==> 🔥 Uninstalling mas from ${PREFIX}"
|
||||||
|
|
||||||
trash -F "$PREFIX/bin/mas" || true
|
trash -F "${PREFIX}/bin/mas" || true
|
||||||
|
|
|
@ -22,11 +22,11 @@ check_class_dump() {
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_private_framework_headers() {
|
extract_private_framework_headers() {
|
||||||
local framework_name="$1"
|
local framework_name="${1}"
|
||||||
shift
|
shift
|
||||||
local directory="Sources/PrivateFrameworks/${framework_name}"
|
local directory="Sources/PrivateFrameworks/${framework_name}"
|
||||||
mkdir -p "$directory"
|
mkdir -p "${directory}"
|
||||||
class-dump -Ho "$directory" "/System/Library/PrivateFrameworks/${framework_name}.framework"
|
class-dump -Ho "${directory}" "/System/Library/PrivateFrameworks/${framework_name}.framework"
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
|
|
@ -15,7 +15,7 @@ fi
|
||||||
|
|
||||||
if [[ -z "${MAS_VERSION:-}" ]] && git describe >/dev/null 2>&1; then
|
if [[ -z "${MAS_VERSION:-}" ]] && git describe >/dev/null 2>&1; then
|
||||||
# Use last tag if MAS_VERSION environment variable is unset or empty
|
# Use last tag if MAS_VERSION environment variable is unset or empty
|
||||||
MAS_VERSION=$(git describe --abbrev=0 --tags 2>/dev/null || true)
|
MAS_VERSION="$(git describe --abbrev=0 --tags 2>/dev/null || true)"
|
||||||
fi
|
fi
|
||||||
echo "${MAS_VERSION#v}"
|
echo "${MAS_VERSION#v}"
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ function usage {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $# -lt 1 ]]; then
|
if [[ "${#}" -lt 1 ]]; then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ MAS_VERSION="${1}"
|
||||||
if [[ "${#}" -ge 2 ]]; then
|
if [[ "${#}" -ge 2 ]]; then
|
||||||
REVISION="${2}"
|
REVISION="${2}"
|
||||||
else
|
else
|
||||||
REVISION=$(git rev-parse "${MAS_VERSION}")
|
REVISION="$(git rev-parse "${MAS_VERSION}")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "MAS_VERSION: ${MAS_VERSION}"
|
echo "MAS_VERSION: ${MAS_VERSION}"
|
||||||
|
@ -53,7 +53,7 @@ echo
|
||||||
cat "${SWIFT_PACKAGE}"
|
cat "${SWIFT_PACKAGE}"
|
||||||
|
|
||||||
# Write new version into brew formulae
|
# Write new version into brew formulae
|
||||||
for file in ${LOCAL_MAS_FORMULA_PATH} ${LOCAL_TAP_FORMULA_PATH}; do
|
for file in "${LOCAL_MAS_FORMULA_PATH}" "${LOCAL_TAP_FORMULA_PATH}"; do
|
||||||
echo "${file}"
|
echo "${file}"
|
||||||
sd '( +tag: +)"[^"]+"' "\$1\"${MAS_VERSION}\"" "${file}"
|
sd '( +tag: +)"[^"]+"' "\$1\"${MAS_VERSION}\"" "${file}"
|
||||||
sd '( +revision: +)"[^"]+"' "\$1\"${REVISION}\"" "${file}"
|
sd '( +revision: +)"[^"]+"' "\$1\"${REVISION}\"" "${file}"
|
||||||
|
|
Loading…
Reference in a new issue