2019-02-12 17:45:44 +01:00
|
|
|
LEKTOR_SERVER_FLAGS=-h 127.0.0.1
|
2019-09-09 21:17:33 +02:00
|
|
|
# minify javascript assets, compile scss assets
|
2022-04-30 20:33:55 +02:00
|
|
|
LEKTOR_PLUGIN_FLAGS=-f scss -f pretifyhtml
|
2019-09-09 21:17:33 +02:00
|
|
|
LEKTOR_DEPLOY_FLAGS=
|
2019-02-12 17:45:44 +01:00
|
|
|
|
2023-04-29 15:23:23 +02:00
|
|
|
.PHONY: all install venv build server deploy pull push
|
|
|
|
|
2019-02-12 17:45:44 +01:00
|
|
|
all: build
|
|
|
|
|
|
|
|
install:
|
2023-04-29 15:23:23 +02:00
|
|
|
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 rsync dos2unix; \
|
|
|
|
elif hash pacman 2>/dev/null; then \
|
|
|
|
pacman -Syu imagemagick python-pip glibc lib32-glibc gcc git-lfs python3-venv rsync dos2unix --noconfirm; \
|
|
|
|
elif hash dnf 2>/dev/null; then \
|
|
|
|
dnf install -y ImageMagick python3-pip gcc git-lfs rsync dos2unix; \
|
|
|
|
else \
|
|
|
|
echo -e "Please install Imagemagick, python3-pip git-lfs, python3-venv, rsync, gcc and dos2unix"; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
venv:
|
|
|
|
if [ -z "${VIRTUAL_ENV}" ]; then \
|
|
|
|
printf "Run '\033[0;33mpython3 -m venv lektor\033[0;37m' to create venv.\nRun '\033[0;33msource lektor/bin/activate\033[0;37m' to activate venv.\n"; \
|
|
|
|
printf "Run '\033[0;33mpip3 install wheel --upgrade\033[0;37m' next.\nRun '\033[0;33mpip3 install lektor --upgrade\033[0;37m' to install lektor\n"; \
|
2019-06-20 14:28:05 +02:00
|
|
|
fi
|
2019-02-12 17:45:44 +01:00
|
|
|
|
2019-06-20 14:28:05 +02:00
|
|
|
build:
|
2023-04-29 15:23:23 +02:00
|
|
|
if [ -z "${VIRTUAL_ENV}" ]; then \
|
|
|
|
printf "Run 'source lektor/bin/activate' to enable venv. Or 'make install' to create venv"; \
|
|
|
|
else \
|
|
|
|
if python3 -m lektor --version 2>/dev/null; then \
|
|
|
|
python3 -m lektor build $(LEKTOR_PLUGIN_FLAGS); \
|
|
|
|
else \
|
|
|
|
lektor build $(LEKTOR_PLUGIN_FLAGS); \
|
|
|
|
fi; \
|
2020-02-07 14:52:28 +01:00
|
|
|
fi
|
2019-02-12 17:45:44 +01:00
|
|
|
|
|
|
|
server:
|
2023-04-29 15:23:23 +02:00
|
|
|
if [ -z "${VIRTUAL_ENV}" ]; then \
|
|
|
|
printf "Run 'source lektor/bin/activate' to enable venv. Or 'make install' to create venv"; \
|
|
|
|
else \
|
|
|
|
if python3 -m lektor --version 2>/dev/null; then \
|
|
|
|
python3 -m lektor server $(LEKTOR_SERVER_FLAGS) $(LEKTOR_PLUGIN_FLAGS); \
|
|
|
|
else \
|
|
|
|
lektor server $(LEKTOR_SERVER_FLAGS) $(LEKTOR_PLUGIN_FLAGS); \
|
|
|
|
fi; \
|
2020-02-07 14:52:28 +01:00
|
|
|
fi
|
2020-08-11 16:34:42 +02:00
|
|
|
|
2023-04-29 15:23:23 +02:00
|
|
|
|
2019-09-09 21:17:33 +02:00
|
|
|
deploy:
|
2023-04-29 15:23:23 +02:00
|
|
|
if [ -z "${VIRTUAL_ENV}" ]; then \
|
|
|
|
printf "Run 'source lektor/bin/activate' to enable venv. Or 'make install' to create venv"; \
|
|
|
|
else \
|
|
|
|
lektor plugin flush-cache; \
|
|
|
|
lektor clean --yes; \
|
|
|
|
rm assets/svg/*; \
|
|
|
|
if python3 -m lektor --version 2>/dev/null; then \
|
|
|
|
python3 -m lektor build $(LEKTOR_PLUGIN_FLAGS) $(LEKTOR_DEPLOY_FLAGS); \
|
|
|
|
unix2dos temp/builds/c3woc.de/waffeln.ics
|
|
|
|
python3 -m lektor deploy $(LEKTOR_PLUGIN_FLAGS) $(LEKTOR_DEPLOY_FLAGS); \
|
|
|
|
else \
|
|
|
|
lektor build $(LEKTOR_PLUGIN_FLAGS) $(LEKTOR_DEPLOY_FLAGS); \
|
|
|
|
unix2dos temp/builds/c3woc.de/waffeln.ics
|
|
|
|
lektor deploy $(LEKTOR_PLUGIN_FLAGS) $(LEKTOR_DEPLOY_FLAGS); \
|
|
|
|
fi; \
|
|
|
|
fi
|
|
|
|
|
2019-12-22 11:54:48 +01:00
|
|
|
|
|
|
|
pull:
|
|
|
|
if git config remote.github.url > /dev/null; then
|
2021-04-13 21:40:57 +02:00
|
|
|
git pull github main
|
2019-12-22 11:54:48 +01:00
|
|
|
else
|
2023-04-29 15:23:23 +02:00
|
|
|
git remote add github https://github.com/c3woc/c3woc-website.git
|
2021-04-13 21:40:57 +02:00
|
|
|
git pull github main
|
2019-12-22 11:54:48 +01:00
|
|
|
fi
|
2021-02-09 00:31:18 +01:00
|
|
|
if git config remote.backwesen.url > /dev/null; then
|
2021-04-13 21:40:57 +02:00
|
|
|
git pull backwesen main
|
2021-02-09 00:31:18 +01:00
|
|
|
else
|
2023-04-29 15:23:23 +02:00
|
|
|
git remote add backwesen https://backwesen.de/c3woc/webseite.git
|
2021-04-13 21:40:57 +02:00
|
|
|
git pull backwesen main
|
2021-02-09 00:31:18 +01:00
|
|
|
fi
|
2021-04-13 21:40:57 +02:00
|
|
|
git pull origin main
|
2019-12-22 11:59:04 +01:00
|
|
|
|
|
|
|
push:
|
|
|
|
if git config remote.github.url > /dev/null; then
|
2021-04-13 21:40:57 +02:00
|
|
|
git push github main
|
2019-12-22 11:59:04 +01:00
|
|
|
else
|
2023-04-29 15:23:23 +02:00
|
|
|
git remote add github https://github.com/c3woc/c3woc-website.git
|
2021-04-13 21:40:57 +02:00
|
|
|
git push github main
|
2019-12-22 11:59:04 +01:00
|
|
|
fi
|
2021-02-09 00:31:18 +01:00
|
|
|
if git config remote.backwesen.url > /dev/null; then
|
2021-04-13 21:40:57 +02:00
|
|
|
git push backwesen main
|
2021-02-09 00:31:18 +01:00
|
|
|
else
|
2023-04-29 15:23:23 +02:00
|
|
|
git remote add backwesen https://backwesen.de/l3d/webseite.git
|
2021-04-13 21:40:57 +02:00
|
|
|
git push github main
|
2021-02-09 00:31:18 +01:00
|
|
|
fi
|