forked from sheltermanager/asm3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
136 lines (110 loc) · 5.12 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
DEPLOY_HOST=servicedx.sheltermanager.com
WWW_HOST=wwwdx.sheltermanager.com
all: compile clean tags minify
dist: version clean minify
rm -rf build
mkdir build
tar -czvf build/sheltermanager3-`cat VERSION`-src.tar.gz changelog LICENSE src README.md scripts/asm3.conf.example scripts/wsgi
cd install/deb && ./makedeb.sh && mv *.deb ../../build
distwin32: dist
cd install/win32 && ./make.sh && mv sheltermanager*exe ../../build/sheltermanager3-`cat ../../VERSION`-win32.exe
tags:
@echo "[tags] ============================"
rm -f tag
ctags -f tags src/*.py
cscope:
@echo "[cscope] ==========================="
find . -name '*.py' > cscope.files
find . -name '*.psp' >> cscope.files
cscope -b -q -k
clean:
@echo "[clean] ============================"
rm -f cscope*
rm -f tags
rm -f src/*.pyc
rm -f src/dbms/*.pyc
rm -f src/locales/*.pyc
rm -f src/publishers/*.pyc
version:
# Include me in any release target to stamp the
# build date
@echo "[version] =========================="
sed "s/^VERSION =.*/VERSION = \"`cat VERSION` [`date`]\"/" src/i18n.py > i18ndt.py
sed "s/^BUILD =.*/BUILD = \"`date +%m%d%H%M`\"/" i18ndt.py > i18njs.py
rm -f i18ndt.py
mv -f i18njs.py src/i18n.py
cp changelog src/static/pages/changelog.txt
minify:
# Generate minified versions of all javascript in min folder
@echo "[minify] ============================="
mkdir -p src/static/js/min
for i in src/static/js/*.js; do echo $$i; cat $$i | scripts/jsmin/jsmin > src/static/js/min/`basename $$i .js`.min.js; done
compile: compilejs compilepy compilejsmin
compilejs:
@echo "[compile javascript] ================="
cd scripts/jslint && ./run.py
compilejsmin:
@echo "[compile jsmin] ======================"
gcc -o scripts/jsmin/jsmin scripts/jsmin/jsmin.c
compilepy:
@echo "[compile python] ====================="
@# 800 lines per method, 35 returns, 20 args, 60 locals
@# pychecker -L 800 -R 35 -J 20 -K 60 -j -b al,email,httplib,multiprocessing,subprocess,threading,web src/*.py src/dbms/*.py src/publishers/*.py
@# pylint --disable=C src/*.py
flake8 --config=scripts/flake8 src/*.py src/dbms/*.py src/publishers/*.py
smcom-dev: version clean minify
@echo "[smcom dev eur01] ===================="
rsync --progress --exclude '*.pyc' --delete -r src/* root@$(DEPLOY_HOST):/usr/local/lib/asm_dev.new
ssh root@$(DEPLOY_HOST) "/root/scripts/sheltermanager_sync_asm.py syncdev only_eur01"
smcom-dev-all: version clean minify
@echo "[smcom dev all] ======================"
rsync --progress --exclude '*.pyc' --delete -r src/* root@$(DEPLOY_HOST):/usr/local/lib/asm_dev.new
ssh root@$(DEPLOY_HOST) "/root/scripts/sheltermanager_sync_asm.py syncdev"
smcom-stable: version clean minify
@echo "[smcom stable] ======================="
@# Having a BREAKING_CHANGES file prevents accidental deploy to stable without dumping sessions or doing it on a schedule
@if [ -f BREAKING_CHANGES ]; then echo "Cannot deploy due to breaking DB changes" && exit 1; fi;
rsync --progress --exclude '*.pyc' --delete -r src/* root@$(DEPLOY_HOST):/usr/local/lib/asm_stable.new
ssh root@$(DEPLOY_HOST) "/root/scripts/sheltermanager_sync_asm.py syncstable"
smcom-stable-dumpsessions: version clean minify
@echo "[smcom stable dumpsessions] ==================="
rsync --exclude '*.pyc' --delete -r src/* root@$(DEPLOY_HOST):/usr/local/lib/asm_stable.new
ssh root@$(DEPLOY_HOST) "/root/scripts/sheltermanager_sync_asm.py syncstable dumpsessions"
smcom-stable-tgz: version clean minify
@echo "[smcom stable tgz] ======================"
rsync --exclude '*.pyc' --delete -r src/* root@$(DEPLOY_HOST):/usr/local/lib/asm_stable.new
ssh root@$(DEPLOY_HOST) "/root/scripts/sheltermanager_sync_asm.py syncstabletgz"
pot:
@echo "[template] ========================="
python po/extract_strings.py > po/asm.pot
translation:
@echo "[translation] ======================"
cd po && ./po_to_python.py
mv po/locale*py src/locales
icons:
@echo "[icons] ==========================="
cd src/static/images/icons && ./z_makecss.sh
mv src/static/images/icons/asm-icon.css src/static/css
manual:
@echo "[manual] =========================="
cd doc/manual && $(MAKE) clean html latexpdf
cp -rf doc/manual/_build/html/* src/static/pages/manual/
scp -C doc/manual/_build/latex/asm3.pdf root@$(WWW_HOST):/var/www/sheltermanager.com/repo/asm3_help.pdf
rsync -a doc/manual/_build/html/ root@$(WWW_HOST):/var/www/sheltermanager.com/repo/asm3_help/
test: version
@echo "[test] ========================="
cd src && python code.py 5000
tests:
@echo "[tests] ========================"
cd test && python suite.py
rm -f test/*.pyc
testsdb:
@echo "[testsdb] ========================"
mysql -u root -proot -e "DROP DATABASE IF EXISTS asmunittest"
mysql -u root -proot -e "CREATE DATABASE asmunittest"
cd src && python cron.py maint_db_install MYSQL localhost 3306 root root asmunittest asmunittest
deps:
@echo "[deps] ========================="
apt-get install python python-imaging python-webpy python-mysqldb python-psycopg2 python-requests python-memcache python-reportlab
apt-get install exuberant-ctags nodejs flake8 imagemagick wkhtmltopdf
apt-get install python-sphinx python-sphinx-rtd-theme texlive-latex-base texlive-latex-extra