forked from devilbox/vhost-gen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
98 lines (77 loc) · 3.7 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Unix Makefile
# Configuration
SHELL = /bin/sh
MKDIR_P = mkdir -p
BINARY = vhost_gen.py
CONFIG = conf.yml
TPLDIR = templates
all:
@echo "Nothing to make."
@echo "Type 'make install' or 'make uninstall'"
help:
@echo Options
@echo " make lint"
@echo " Check for python errors"
@echo ""
@echo " make test"
@echo " Test vhost-gen"
@echo ""
@echo " make install"
@echo " Install everthing (requires sudo or root)"
@echo ""
@echo " make uninstall"
@echo " Remove everything (requires sudo or root)"
@echo ""
@echo " make help"
@echo " Show this help screen"
lint:
if pycodestyle --version >/dev/null 2>&1; then pycodestyle -v --max-line-length=100 bin/vhost_gen.py; else echo "not installed"; fi
if pylint --version >/dev/null 2>&1; then pylint bin/vhost_gen.py; else echo "not installed"; fi
if flake8 --version >/dev/null 2>&1; then flake8 --max-line-len=100 bin/vhost_gen.py; else echo "not installed"; fi
test:
# [NORMAL] Check for python errors
./bin/vhost_gen.py -p ./ -n name -t etc/templates/ >/dev/null
./bin/vhost_gen.py -p ./ -n name -t etc/templates/ -c etc/conf.yml >/dev/null
./bin/vhost_gen.py -p ./ -n name -t etc/templates/ -c examples/conf.nginx.yml >/dev/null
./bin/vhost_gen.py -p ./ -n name -t etc/templates/ -c examples/conf.apache22.yml >/dev/null
./bin/vhost_gen.py -p ./ -n name -t etc/templates/ -c examples/conf.apache24.yml >/dev/null
# [REVERSE] Check for python errors
./bin/vhost_gen.py -r http://127.0.0.1:3000 -l / -n name -t etc/templates/ >/dev/null
./bin/vhost_gen.py -r http://127.0.0.1:3000 -l / -n name -t etc/templates/ -c etc/conf.yml >/dev/null
./bin/vhost_gen.py -r http://127.0.0.1:3000 -l / -n name -t etc/templates/ -c examples/conf.nginx.yml >/dev/null
./bin/vhost_gen.py -r http://127.0.0.1:3000 -l / -n name -t etc/templates/ -c examples/conf.apache22.yml >/dev/null
./bin/vhost_gen.py -r http://127.0.0.1:3000 -l / -n name -t etc/templates/ -c examples/conf.apache24.yml >/dev/null
# [NORMAL] Check for template generation errors
./bin/vhost_gen.py -p ./ -n name -t etc/templates/ | grep -v '__'
./bin/vhost_gen.py -p ./ -n name -t etc/templates/ -c etc/conf.yml | grep -v '__'
./bin/vhost_gen.py -p ./ -n name -t etc/templates/ -c examples/conf.nginx.yml | grep -v '__'
./bin/vhost_gen.py -p ./ -n name -t etc/templates/ -c examples/conf.apache22.yml | grep -v '__'
./bin/vhost_gen.py -p ./ -n name -t etc/templates/ -c examples/conf.apache24.yml | grep -v '__'
# [REVERSE] Check for template generation errors
./bin/vhost_gen.py -r http://127.0.0.1:3000 -l / -n name -t etc/templates/ | grep -v '__'
./bin/vhost_gen.py -r http://127.0.0.1:3000 -l / -n name -t etc/templates/ -c etc/conf.yml | grep -v '__'
./bin/vhost_gen.py -r http://127.0.0.1:3000 -l / -n name -t etc/templates/ -c examples/conf.nginx.yml | grep -v '__'
./bin/vhost_gen.py -r http://127.0.0.1:3000 -l / -n name -t etc/templates/ -c examples/conf.apache22.yml | grep -v '__'
./bin/vhost_gen.py -r http://127.0.0.1:3000 -l / -n name -t etc/templates/ -c examples/conf.apache24.yml | grep -v '__'
install:
@echo "Installing files"
@echo ""
@# Create directories
${MKDIR_P} /etc/vhost-gen
${MKDIR_P} /etc/vhost-gen/templates
@# Install binary
install -m 0755 bin/${BINARY} /usr/bin/${BINARY}
@# Install configs
install -m 0644 etc/${CONFIG} /etc/vhost-gen/${CONFIG}
install -m 0644 etc/${TPLDIR}/*.yml /etc/vhost-gen/${TPLDIR}
@echo "Installation complete:"
@echo "----------------------------------------------------------------------"
@echo ""
uninstall:
@echo "Removing files"
@echo ""
rm -r /etc/vhost-gen
rm /usr/bin/${BINARY}
@echo "Uninstallation complete:"
@echo "----------------------------------------------------------------------"
@echo ""