feat: add oneline install

This commit is contained in:
Daylin Morgan 2023-01-20 13:29:42 -06:00
parent d403975a4b
commit cc198afad3
3 changed files with 37 additions and 0 deletions

View file

@ -29,6 +29,7 @@ assets: ## generate assets
define release_sh
./generate.py $(subst v,,$(VERSION)) > task.mk
sed -i 's/task.mk\/.*\/task.mk/task.mk\/$(VERSION)\/task.mk/g' README.md docs/index.md
sed -i 's/TASKMK_VERSION=.*/TASKMK_VERSION=$(VERSION)/' docs/init
git add task.mk README.md docs/index.md
git commit -m "release: $(VERSION)" --no-verify
git tag $(VERSION)

View file

@ -32,6 +32,11 @@ You can automagically include it with just two additional lines to your `Makefil
## Setup
One line setup:
```bash
bash <(curl -fsSL gh.dayl.in/task.mk/init) # or w/ TASKMK_VERSION=
```
You can include this as an optional dependency on your project by adding the below lines to the end of your `Makefile`.
If someone tries to invoke `make help` it will download `.task.mk` for them.

31
docs/init Normal file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -e
TASKMK_VERSION=v23.1.1
VERSION=${1:-$TASKMK_VERSION}
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
echo '-include .task.cfg.mk .task.mk' >>Makefile
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