Files
nicholaswilde_recipes/Taskfile.yaml
nιcнolaѕ wιlde b86eba2e7d feat: add commit task
Signed-off-by: nιcнolaѕ wιlde <ncwilde43@gmail.com>
2022-09-05 00:49:51 -07:00

143 lines
3.8 KiB
YAML

---
version: '3'
vars:
ROOT_DIR:
sh: git rev-parse --show-toplevel
PORT: 8000
tasks:
clean:
desc: Clean markdown files from cook dir
cmds:
- find cook -name "*.md" -delete
deps:
desc: Install dependencies
cmds:
- npm install --location=global spellchecker-cli
docker-serve:
desc: Serve an mkdocs server using Docker
cmds:
- >-
docker run --rm -it -p {{ .PORT }}:{{ .PORT}} -v ${PWD}:/docs
--platform linux/amd64 squidfunk/mkdocs-material serve
--dev-addr 0.0.0.0:{{ .PORT }} -f ./mkdocs.yml
linkcheck:
desc: Check for dead links
cmds:
- ./scripts/linkcheck.sh
linkcheck-file:
desc: Link check a given file
cmds:
- >-
docker run --rm -v /:/tmp:ro -i -w /tmp ghcr.io/tcort/markdown-link-check:stable
"/tmp{{.f}}" -c "/tmp{{ .ROOT_DIR }}/mlc_config.json" || exit 1
vars:
f:
sh: "readlink -f {{shellQuote .FILE}}"
lint:
desc: Lint the project
cmds:
- task: markdownlint
- task: yamllint
list-ingredients:
desc: List all ingredients in all cook recipes and copy to clipboard.
cmds:
- ./scripts/list-ingredients.sh
markdownlint:
desc: Run markdownlint-cli
cmds:
- >-
docker run --rm -it -v ${PWD}:/markdown:ro
06kellyjac/markdownlint-cli .
markdownlint-fix:
desc: Run markdownlint-cli fix
cmds:
- >-
docker run --rm -it -v ${PWD}:/markdown:ro
06kellyjac/markdownlint-cli -f .
serve:
desc: >-
Start development server on http://0.0.0.0:{{ .PORT }} using
Docker and mkdocs-material
cmds:
- >-
docker run --rm -it -p {{ .PORT }}:{{ .PORT}} -v ${PWD}:/docs
--platform linux/amd64 squidfunk/mkdocs-material serve
--dev-addr 0.0.0.0:{{ .PORT }} -f ./mkdocs.yml
serve-local:
desc: Serve a local mkdocs server
cmds:
- mkdocs serve
silent: true
server:
desc: Serve a cook server
cmds:
- cook server
silent: true
emoji:
desc: Show available emoji
cmds:
- yq '.emoji' includes/emoji.yaml
emoji-ing:
desc: Show available ingredients emoji
cmds:
- yq '.emoji.ingredients' includes/emoji.yaml
emoji-cw:
desc: Show available cookware emoji
cmds:
- yq '.emoji.cookware' includes/emoji.yaml
emoji-search:
desc: Search for emoji
cmds:
- yq '.emoji.ingredients[]|pick(["{{ .SHORTCODE }}"])|select(length>0)' includes/emoji.yaml
emoji-sort:
desc: Sort emoji.yaml
cmds:
- yq -i 'sort_keys(.emoji)' includes/emoji.yaml
- yq -i '.emoji.cookware|=sort_by(keys | .[0])' includes/emoji.yaml
- yq -i '.emoji.ingredients|=sort_by(keys | .[0])' includes/emoji.yaml
- yq includes/emoji.yaml
sort:
desc: Sort dictionary.txt
cmds:
- sort {{ .ROOT_DIR }}/dictionary.txt -u -o {{ .ROOT_DIR }}/dictionary.txt
spellcheck:
desc: Spellcheck cook files
cmds:
- ./scripts/spellcheck.sh
spellcheck-file:
desc: Spellcheck a single file
cmds:
- npx spellchecker -d {{ .ROOT_DIR }}/dictionary.txt -f {{shellQuote .f }}
vars:
f:
sh: "readlink -f {{shellQuote .FILE}}"
commit:
desc: Commit new cook files.
cmds:
- ./scripts/commit.sh "{{shellQuote .FILES }}"
yamllint:
desc: Run yamllint
cmds:
- >-
docker run --rm -it -v ${PWD}:${PWD}:ro -w ${PWD}
programmerassistant/yamllint yamllint .
move:
desc: Move recipe markdown file and image.
cmds:
- ./scripts/move.sh {{shellQuote .FILE }}
deg:
desc: Replace temperatures with degree symbols
cmds:
- >-
sed -E -i -e 's/([[:digit:]]+)F/\1°F/'
-e 's/ degrees F/°F/'
-e 's/ degrees/°F/'
-e 's/([[:digit:]]+)[[:space:]]F/\1°F/' {{shellQuote .FILE }}
default:
cmds:
- task -a
silent: true