This repository has been archived by the owner on Jan 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
70 lines (65 loc) · 2.25 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
LEKTOR_SERVER_FLAGS=-h 127.0.0.1
# minify javascript assets, compile scss assets
LEKTOR_PLUGIN_FLAGS=-f scss
LEKTOR_DEPLOY_FLAGS=
all:
set -e
sudo make install
make build
make server
.ONESHELL:
install:
echo -e "\nYou have to run make install with sudo\n"
set -e
if hash nix 2>/dev/null; then
nix-shell --comand 'Done!'
else
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
elif hash pacman 2>/dev/null; then
pacman -Sy imagemagick python-pip glibc lib32-glibc gcc git-lfs dos2unix --noconfirm
elif hash dnf 2>/dev/null; then
dnf install -y ImageMagick python3-pip gcc git-lfs
else
echo -e "Please install Imagemagick, python3-pip git-lfs and gcc dos2unix"
fi
pip3 install wheel --upgrade
pip3 install lektor --upgrade
pip3 install lektor-scss --upgrade
fi
build:
set -e
if hash nix 2>/dev/null; then
# sadly lektor has its own not configurable package installer
# remove all referenced plugins and load them manually in shell.nix
sed -n '/packages/q;p' vebit.lektorproject > vebit.lektorproject.tmp
mv vebit.lektorproject.tmp vebit.lektorproject
nix-shell --command 'lektor build'
elif python3 -m lektor --version 2>/dev/null; then
python3 -m lektor build $(LEKTOR_PLUGIN_FLAGS)
else
lektor build $(LEKTOR_PLUGIN_FLAGS)
fi
if hash unix2dos 2>/dev/null; then
unix2dos temp/builds/vebit.xyz/termine/*.ics
fi
server:
set -e
if hash nix 2>/dev/null; then
# sadly lektor has its own not configurable package installer
# remove all referenced plugins and load them manually in shell.nix
sed -n '/packages/q;p' vebit.lektorproject > vebit.lektorproject.tmp
mv vebit.lektorproject.tmp vebit.lektorproject
nix-shell --command 'lektor server'
elif 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
deploy:
set -e
lektor build $(LEKTOR_PLUGIN_FLAGS) $(LEKTOR_DEPLOY_FLAGS)
if hash unix2dos 2>/dev/null; then
unix2dos temp/builds/vebit.xyz/termine/*.ics
fi
lektor deploy $(LEKTOR_PLUGIN_FLAGS) $(LEKTOR_DEPLOY_FLAGS) --key-file ~/.ssh/ssh_ed25519