2022-06-16 01:18:13 -05:00
|
|
|
SRC_FILES := $(wildcard yartsu/*)
|
|
|
|
VERSION := $(shell pdm show | grep "Installed" | awk -F ":" 'gsub(/ /, ""){print $$2}')
|
2022-06-14 18:35:47 -05:00
|
|
|
|
2022-06-16 01:18:13 -05:00
|
|
|
.PHONY: list lint build typing format dist check-tag release-asset
|
2022-06-15 13:38:45 -05:00
|
|
|
|
2022-06-14 18:35:47 -05:00
|
|
|
lint: format typing
|
|
|
|
|
|
|
|
typing:
|
|
|
|
pdm run mypy yartsu
|
|
|
|
|
|
|
|
format:
|
|
|
|
pdm run pre-commit run --all
|
|
|
|
|
2022-06-15 13:38:45 -05:00
|
|
|
check-tag:
|
|
|
|
@[ "${TAG}" ] || ( echo ">> TAG is not set"; exit 1 )
|
|
|
|
@git describe HEAD --tags --exact-match
|
|
|
|
|
2022-06-16 01:47:31 -05:00
|
|
|
check-version:
|
|
|
|
@if [[ "${VERSION}" == *"+"* ]]; then \
|
|
|
|
echo ">> VERSION is dev"; \
|
|
|
|
echo ">> $(VERSION)"; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
release-assets: build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu check-version
|
2022-06-16 01:18:13 -05:00
|
|
|
tar czf build/yartsu-$(VERSION)-x86_64-linux.tar.gz \
|
|
|
|
build/x86_64-unknown-linux-gnu/release/install/yartsu
|
|
|
|
|
2022-06-16 01:29:10 -05:00
|
|
|
release: check-tag release-assets
|
2022-06-16 01:18:13 -05:00
|
|
|
gh release create $(TAG) build/yartsu-$(VERSION)-x86_64-linux.tar.gz -p -d
|
2022-06-15 13:38:45 -05:00
|
|
|
|
2022-06-16 01:52:53 -05:00
|
|
|
publish: check-version dist
|
2022-06-15 13:38:45 -05:00
|
|
|
twine upload dist/*
|
|
|
|
|
|
|
|
dist:
|
|
|
|
pdm build
|
|
|
|
|
2022-06-14 18:35:47 -05:00
|
|
|
build: build/yartsu
|
|
|
|
|
2022-06-16 01:18:13 -05:00
|
|
|
build/shiv/yartsu: $(SRC_FILES)
|
|
|
|
mkdir -p build/shiv
|
2022-06-14 18:35:47 -05:00
|
|
|
shiv \
|
2022-06-16 01:18:13 -05:00
|
|
|
-c yartsu \
|
|
|
|
-o ./build/shiv/yartsu \
|
|
|
|
--preamble scripts/preamble.py \
|
|
|
|
--reproducible \
|
|
|
|
.
|
|
|
|
|
|
|
|
build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu: $(SRC_FILES)
|
2022-06-16 01:47:31 -05:00
|
|
|
pdm install
|
2022-06-16 01:18:13 -05:00
|
|
|
pyoxidizer build --release
|
|
|
|
|
|
|
|
install-bin: build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu
|
|
|
|
cp ./build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu ~/bin
|
2022-06-14 18:35:47 -05:00
|
|
|
|
2022-06-16 01:18:13 -05:00
|
|
|
install-shiv: build/shiv/yartsu
|
|
|
|
cp ./build/shiv/yartsu ~/bin
|
2022-06-14 18:35:47 -05:00
|
|
|
|
2022-06-15 15:35:29 -05:00
|
|
|
.PHONY: svg-docs theme-docs diff-docs demo-docs docs
|
|
|
|
|
|
|
|
docs: svg-docs theme-docs demo-docs diff-docs
|
2022-06-14 18:35:47 -05:00
|
|
|
|
|
|
|
theme-docs:
|
|
|
|
./scripts/theme-showcase-gen
|
|
|
|
|
2022-06-15 15:35:29 -05:00
|
|
|
diff-docs:
|
2022-06-16 13:28:45 -05:00
|
|
|
./scripts/rich-diff > docs/rich-diff.md
|
2022-06-15 15:35:29 -05:00
|
|
|
|
2022-06-14 18:35:47 -05:00
|
|
|
svg-docs:
|
|
|
|
lolcat -F .5 -S 9 -f assets/logo.txt | yartsu -o assets/logo.svg
|
|
|
|
yartsu -o assets/yartsu.svg -t "yartsu --help" -- yartsu -h
|
|
|
|
|
2022-06-15 02:11:32 -05:00
|
|
|
demo-docs:
|
|
|
|
python -c \
|
|
|
|
"from rich.console import Console; \
|
2022-06-16 01:18:13 -05:00
|
|
|
console = Console(force_terminal=True); \
|
|
|
|
console.print('\n:snake: [b i]Emoji\'s!'); \
|
|
|
|
console.print(' [cyan]Nerd Fonts!');" | \
|
|
|
|
yartsu -w 25 -o assets/demo.svg
|
2022-06-15 15:35:29 -05:00
|
|
|
|
2022-06-15 13:38:45 -05:00
|
|
|
clean:
|
2022-06-16 01:18:13 -05:00
|
|
|
rm -rf build dist capture.svg
|
2022-06-15 02:11:32 -05:00
|
|
|
|
2022-06-14 18:35:47 -05:00
|
|
|
# https://stackoverflow.com/a/26339924
|
|
|
|
list:
|
|
|
|
@LC_ALL=C $(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
|