2023-01-20 13:29:42 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
2023-01-22 14:41:13 -06:00
|
|
|
LATEST_TASKMK_VERSION="v23.1.1"
|
2023-01-22 12:08:02 -06:00
|
|
|
VERSION=${TASKMK_VERSION:-$LATEST_TASKMK_VERSION}
|
2023-01-20 13:29:42 -06:00
|
|
|
printf "Initializing Task.mk (%s) for repo\n" "$VERSION"
|
|
|
|
if [ -f "./.task.mk" ]; then
|
|
|
|
echo "Found local .task.mk."
|
|
|
|
echo "Was it already initialized?"
|
|
|
|
echo 'Exiting....'
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
curl -fsSL "https://raw.githubusercontent.com/daylinmorgan/task.mk/$VERSION/task.mk" -o .task.mk
|
|
|
|
echo .task.mk >>.gitignore
|
2023-01-22 14:41:13 -06:00
|
|
|
printf '\n-include .task.cfg.mk .task.mk\n' >>Makefile
|
2023-01-20 13:29:42 -06:00
|
|
|
printf '$(if $(filter help,$(MAKECMDGOALS)),$(if $(wildcard .task.mk),,.task.mk: ; curl -fsSL https://raw.githubusercontent.com/daylinmorgan/task.mk/%s/task.mk -o .task.mk))' \
|
|
|
|
"$VERSION" \
|
|
|
|
>>Makefile
|
|
|
|
|
|
|
|
printf ".task.mk files added to repo\n\n"
|
|
|
|
echo "Do you want to commit these changes?"
|
|
|
|
printf "RUN COMMAND: %s (Y/n) " \
|
|
|
|
"git add Makefile .gitignore && git commit -m \"chore: initialize .task.mk\""
|
|
|
|
|
|
|
|
read -r answer
|
|
|
|
# if echo "$answer" | grep -iq "^y" ;then
|
|
|
|
if [ "$answer" != "${answer#[Yy]}" ]; then
|
|
|
|
git add Makefile .gitignore && git commit -m "chore: initialize .task.mk"
|
|
|
|
echo finished.
|
|
|
|
else
|
|
|
|
echo finished.
|
|
|
|
fi
|