-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathMakefile
166 lines (131 loc) · 4.65 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
all: setup_py setup_coveralls setup_js setup_django
ci: setup_ci all
staging: create-staging update-staging
define resetdb_to_backup
dropdb $1
createdb $1
pg_restore -O -x -n public -d $1 ~hacklab/sql-backup/last.psqlc
endef
define reset_media
rm -rf ~/webfiles/media/
cp -r ~timtec-production/webfiles/media ~/webfiles/
endef
define base_update
cp timtec/settings_local_$1.py timtec/settings_local.py
~/env/bin/pip install --upgrade pip
~/env/bin/pip install -U -r requirements/test.txt
npm install
~/env/bin/python manage.py migrate --noinput --fake-initial
~/env/bin/python manage.py collectstatic --noinput
~/env/bin/python manage.py compress
~/env/bin/python manage.py compilemessages
endef
update:
~/env/bin/pip install --upgrade pip
~/env/bin/pip install -U -r requirements/production.txt
npm install
./node_modules/bower/bin/bower install
~/env/bin/python manage.py migrate --noinput --fake-initial
~/env/bin/python manage.py collectstatic --noinput
~/env/bin/python manage.py compress
~/env/bin/python manage.py compilemessages
install:
virtualenv ~/env
~/env/bin/pip install --upgrade pip
~/env/bin/pip install -r requirements/production.txt
npm install
./node_modules/bower/bin/bower install
mkdir -p ~/webfiles/static
mkdir -p ~/webfiles/media
cp timtec/settings_local.py.template timtec/settings_local.py
~/env/bin/python manage.py migrate --noinput
~/env/bin/python manage.py loaddata initial
~/env/bin/python manage.py collectstatic --noinput
~/env/bin/python manage.py compress
~/env/bin/python manage.py compilemessages
docker-update:
npm install
/app/timtec/node_modules/bower/bin/bower install
python manage.py migrate --noinput --fake-initial
python manage.py compress
python manage.py collectstatic --noinput
python manage.py compilemessages
create-staging:
virtualenv ~/env
~/env/bin/pip install -r requirements/production.txt
npm install
mkdir -p ~/webfiles/static
mkdir -p ~/webfiles/media
create-production: create-staging
cp timtec/settings_local_production.py timtec/settings_local.py
cp ../settings_production.py timtec/settings_production.py
~/env/bin/python manage.py syncdb --noinput --no-initial-data
~/env/bin/python manage.py migrate --noinput --no-initial-data
~/env/bin/python manage.py collectstatic --noinput
~/env/bin/python manage.py compilemessages
update-test:
$(call resetdb_to_backup,timtec-test)
$(call reset_media)
$(call base_update,test)
update-dev:
$(call resetdb_to_backup,timtec-dev)
$(call reset_media)
$(call base_update,timtec_dev)
update-demo:
$(call base_update,demo)
update-staging:
$(call base_update,staging)
update-ifsul:
$(call base_update,ifsul)
update-design:
$(call base_update,design)
update-production:
cp ../settings_production.py timtec/settings_production.py
$(call base_update,production)
test_collectstatic: clean
py.test --collectstatic tests/test_collectstatic.py
clean:
find . -type f -name '*.py[co]' -exec rm {} \;
python_tests: clean
py.test --pep8 --flakes --splinter-webdriver=phantomjs --cov . . $*
js_tests:
find . -path ./bower_components -prune -o -path bower_components/ -prune -o -path ./node_modules -prune -o -regex ".*/vendor/.*" -prune -o -name '*.js' -exec ./node_modules/jshint/bin/jshint {} \;
all_tests: clean python_tests js_tests test_collectstatic
setup_ci:
psql -c 'create database timtec_ci;' -U postgres
pip install --upgrade pip
cp timtec/settings_local_ci.py timtec/settings_local.py
setup_py:
pip install -r requirements/test.txt
python setup.py -q develop
setup_coveralls:
pip install -q coveralls
setup_js:
npm install # --loglevel silent
./node_modules/bower/bin/bower install
setup_django: clean
python manage.py migrate --noinput
python manage.py loaddata initial
python manage.py compilemessages
dumpdata: clean
@python manage.py dumpdata --indent=2 -n -e south.migrationhistory -e admin.logentry -e socialaccount.socialaccount -e socialaccount.socialapp -e sessions.session -e contenttypes.contenttype -e auth.permission -e account.emailconfirmation -e socialaccount.socialtoken
dumpcourses:
python manage.py dumpdata --indent=2 -n -e south -e admin -e socialaccount -e sessions -e contenttypes -e auth -e account -e accounts -e notes| gzip -9 > courses.json.gz
reset_db: clean
python manage.py reset_db --router=default --noinput -U $(USER)
python manage.py syncdb --noinput
python manage.py migrate --noinput
messages: clean
python manage.py makemessages -a -d django
doc_install:
virtualenv docs/env
make doc_update
doc_update:
docs/env/bin/pip install --upgrade pip
docs/env/bin/pip install -U -r docs/requirements.txt
doc_build:
make doc_update
docs/env/bin/mkdocs build
doc_run:
make doc_update
docs/env/bin/mkdocs serve