mas/script/bootstrap
2024-03-31 11:05:04 -06:00

60 lines
1 KiB
Bash
Executable file

#!/bin/bash -e
#
# script/bootstrap
# mas
#
# Installs development dependencies and builds project dependencies.
#
function usage {
echo "Usage: bootstrap [-f]"
echo " -f option enables frozen mode"
exit 1
}
frozen=''
# Detect presence of `-f` frozen option
while getopts "f" opt; do
case "${opt}" in
f)
frozen='-f'
;;
*)
usage 1>&2
;;
esac
done
main() {
script/clean
echo "==> 👢 Bootstrapping"
# Install Homebrew tools
if [[ "${frozen}" == "-f" ]]; then
# --no-lock Don't touch Brewfile.lock.json
brew bundle install --no-lock --no-upgrade --verbose
else
# Allow upgrades
rm -f Brewfile.lock.json
brew bundle install --verbose
fi
if [[ ! -x "$(command -v mise)" ]]; then
brew install mise
fi
mise settings set experimental true
mise install --verbose
mise list --verbose
# Already installed on GitHub Actions runner.
if [[ ! -x "$(command -v swiftlint)" ]]; then
brew install swiftlint
fi
# Generate Package.swift
script/version
}
main