improve Makefile
This commit is contained in:
parent
390a62bd02
commit
ab2bd2bd12
1 changed files with 49 additions and 40 deletions
89
Makefile
89
Makefile
|
@ -3,59 +3,68 @@ LEKTOR_SERVER_FLAGS=-h 127.0.0.1
|
||||||
LEKTOR_PLUGIN_FLAGS=-f scss -f pretifyhtml
|
LEKTOR_PLUGIN_FLAGS=-f scss -f pretifyhtml
|
||||||
LEKTOR_DEPLOY_FLAGS=
|
LEKTOR_DEPLOY_FLAGS=
|
||||||
|
|
||||||
|
.PHONY: all install venv build server dev deploy
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
.ONESHELL:
|
|
||||||
install:
|
install:
|
||||||
if hash apt-get 2>/dev/null; then
|
if hash apt-get 2>/dev/null; then \
|
||||||
apt-get update -qq >/dev/null && apt-get install -qq apt-utils imagemagick python3-pip python3-setuptools gcc git-lfs python3-venv
|
apt-get update -qq >/dev/null && apt-get install -qq apt-utils imagemagick python3-pip python3-setuptools gcc git-lfs python3-venv; \
|
||||||
elif hash pacman 2>/dev/null; then
|
elif hash pacman 2>/dev/null; then \
|
||||||
pacman -Syu imagemagick python-pip glibc lib32-glibc gcc git-lfs python3-venv --noconfirm
|
pacman -Syu imagemagick python-pip glibc lib32-glibc gcc git-lfs python3-venv --noconfirm; \
|
||||||
elif hash dnf 2>/dev/null; then
|
elif hash dnf 2>/dev/null; then \
|
||||||
dnf install -y ImageMagick python3-pip gcc git-lfs
|
dnf install -y ImageMagick python3-pip gcc git-lfs; \
|
||||||
else
|
else \
|
||||||
echo -e "Please install Imagemagick, python3-pip git-lfs, python3-venv and gcc"
|
echo -e "Please install Imagemagick, python3-pip git-lfs, python3-venv and gcc"; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
venv:
|
||||||
|
if [ -z "${VIRTUAL_ENV}" ]; then \
|
||||||
|
printf "Run 'python3 -m venv lektor' to create venv.\nRun 'source lektor/bin/activate' to activate venv.\n"; \
|
||||||
|
printf "Run 'pip3 install wheel --upgrade' next.\nRun 'pip3 install lektor --upgrade' to install lektor"; \
|
||||||
fi
|
fi
|
||||||
pip3 install wheel --upgrade
|
|
||||||
pip3 install lektor --upgrade
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
if [[ "$VIRTUAL_ENV" != "" ]]; then
|
if [ -z "${VIRTUAL_ENV}" ]; then \
|
||||||
source lektor/bin/activate || python -m venv lektor && source lektor/bin/activate
|
printf "Run 'source lektor/bin/activate' to enable venv. Or 'make install' to create venv"; \
|
||||||
fi
|
else \
|
||||||
if python3 -m lektor --version 2>/dev/null; then
|
if python3 -m lektor --version 2>/dev/null; then \
|
||||||
python3 -m lektor build $(LEKTOR_PLUGIN_FLAGS)
|
python3 -m lektor build $(LEKTOR_PLUGIN_FLAGS); \
|
||||||
else
|
else \
|
||||||
lektor build $(LEKTOR_PLUGIN_FLAGS)
|
lektor build $(LEKTOR_PLUGIN_FLAGS); \
|
||||||
|
fi; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
server:
|
server:
|
||||||
if [[ "$VIRTUAL_ENV" != "" ]]; then
|
if [ -z "${VIRTUAL_ENV}" ]; then \
|
||||||
source lektor/bin/activate || python -m venv lektor && source lektor/bin/activate
|
printf "Run 'source lektor/bin/activate' to enable venv. Or 'make install' to create venv"; \
|
||||||
fi
|
else \
|
||||||
if python3 -m lektor --version 2>/dev/null; then
|
if python3 -m lektor --version 2>/dev/null; then \
|
||||||
python3 -m lektor server $(LEKTOR_SERVER_FLAGS) $(LEKTOR_PLUGIN_FLAGS)
|
python3 -m lektor server $(LEKTOR_SERVER_FLAGS) $(LEKTOR_PLUGIN_FLAGS); \
|
||||||
else
|
else \
|
||||||
lektor server $(LEKTOR_SERVER_FLAGS) $(LEKTOR_PLUGIN_FLAGS)
|
lektor server $(LEKTOR_SERVER_FLAGS) $(LEKTOR_PLUGIN_FLAGS); \
|
||||||
|
fi; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
if [[ "$VIRTUAL_ENV" != "" ]]; then
|
if [ -z "${VIRTUAL_ENV}" ]; then \
|
||||||
source lektor/bin/activate || python -m venv lektor && source lektor/bin/activate
|
printf "Run 'source lektor/bin/activate' to enable venv. Or 'make install' and 'make venv' to create venv"; \
|
||||||
fi
|
else \
|
||||||
lektor plugin flush-cache
|
lektor plugin flush-cache; \
|
||||||
lektor clean --yes
|
lektor clean --yes ; \
|
||||||
if python3 -m lektor --version 2>/dev/null; then
|
if python3 -m lektor --version 2>/dev/null; then \
|
||||||
python3 -m lektor server $(LEKTOR_SERVER_FLAGS) $(LEKTOR_PLUGIN_FLAGS)
|
python3 -m lektor server $(LEKTOR_SERVER_FLAGS) $(LEKTOR_PLUGIN_FLAGS); \
|
||||||
else
|
else \
|
||||||
lektor server $(LEKTOR_SERVER_FLAGS) $(LEKTOR_PLUGIN_FLAGS)
|
lektor server $(LEKTOR_SERVER_FLAGS) $(LEKTOR_PLUGIN_FLAGS); \
|
||||||
|
fi; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
if [[ "$VIRTUAL_ENV" != "" ]]; then
|
if [ -z "${VIRTUAL_ENV}" ]; then \
|
||||||
source lektor/bin/activate || python -m venv lektor && source lektor/bin/activate
|
printf "Run 'source lektor/bin/activate' to enable venv. Or 'make install' and 'make venv' to create venv"; \
|
||||||
|
else
|
||||||
|
lektor clean --yes; \
|
||||||
|
lektor plugin flush-cache; \
|
||||||
|
lektor build $(LEKTOR_PLUGIN_FLAGS) $(LEKTOR_DEPLOY_FLAGS); \
|
||||||
|
lektor deploy $(LEKTOR_PLUGIN_FLAGS) $(LEKTOR_DEPLOY_FLAGS); \
|
||||||
fi
|
fi
|
||||||
lektor clean --yes
|
|
||||||
lektor plugin flush-cache
|
|
||||||
lektor build $(LEKTOR_PLUGIN_FLAGS) $(LEKTOR_DEPLOY_FLAGS)
|
|
||||||
lektor deploy $(LEKTOR_PLUGIN_FLAGS) $(LEKTOR_DEPLOY_FLAGS)
|
|
||||||
|
|
Loading…
Reference in a new issue