forked from UWFlow/rmc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
135 lines (107 loc) · 3.74 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
SHELL=/bin/bash
.PHONY: local setup import_menlo import_critiques aggregate_data init_data \
prod_import prod_import_mongo html_snapshots sitemap deploy clean \
test require_virtualenv_in_dev
local: require_virtualenv_in_dev
./local_server.sh
install: os-install common-install ;
os-install:
if [ `uname -s` = Linux ]; then ./linux-setup.sh; fi
if [ `uname -s` = Darwin ]; then ./mac-setup.sh; fi
common-install:
./setup.sh
# TODO(mack): Find better way to vary command based on prod/dev
# TODO(mack): Add command to clear cache directory:
# - Mac OS X: ~/Library/Caches/Ofi\ Labs/PhantomJS
# - Linux: Find out
html_snapshots: require_virtualenv_in_dev
@if [ `whoami` = 'rmc' ]; then \
PYTHONPATH=.. python html_snapshots/snapshot.py https://uwflow.com --overwrite; \
else \
PYTHONPATH=.. python html_snapshots/snapshot.py http://localhost:5000 --overwrite; \
fi
lint: require_virtualenv_in_dev
third_party/rmc_linter/runlint.py | tee /tmp/linterrors.txt
sitemap: require_virtualenv_in_dev
rm -f server/static/sitemap.txt
PYTHONPATH=.. python html_snapshots/sitemap.py https://uwflow.com > server/static/sitemap.txt
curl www.google.com/webmasters/tools/ping?sitemap=https://uwflow.com/static/sitemap.txt
update_html_snapshots: require_virtualenv_in_dev html_snapshots sitemap
import_critiques: require_virtualenv_in_dev
PYTHONPATH=.. python data/evals/import_critiques.py data/evals/output/results_testing.txt
aggregate_data: require_virtualenv_in_dev
PYTHONPATH=.. python data/aggregator.py daily
init_data:
@echo "*** Seeding data. This may take up to an hour. ***"
@echo
PYTHONPATH=.. python data/aggregator.py courses
@echo "Importing professors"
PYTHONPATH=.. python data/processor.py professors
@echo "Importing reviews"
PYTHONPATH=.. python data/processor.py reviews
@echo "Importing sections"
PYTHONPATH=.. python data/aggregator.py sections
@echo "Importing scholarships"
PYTHONPATH=.. python data/aggregator.py scholarships
@echo "Aggregating data"
PYTHONPATH=.. python data/aggregator.py daily
train_engine: require_virtualenv_in_dev
@echo "Training the recommendation engine"
PYTHONPATH=..:${SPARK_HOME}/python python data/engine.py
export_data:
mongodump --db rmc
export_data_to_dropbox:
ssh rmc 'mongodump --db rmc'
rsync -avz rmc:~/dump ~/Dropbox/Flow/db/
( cd ~/Dropbox/Flow/db/ && zip -r dump.zip dump -x "**.DS_Store" )
prod_import: prod_import_mongo aggregate_data
prod_import_mongo:
@if [ `whoami` = 'rmc' ]; then \
echo "You're in prod!!! Don't dump our data :("; \
else \
rsync -avz rmc:~/dump .; \
mongorestore --drop dump; \
fi
deploy_skiptest:
@if [ `whoami` = 'rmc' ]; then \
./deploy.sh; \
else \
cat deploy.sh | ssh rmc DEPLOYER=`whoami` sh; \
fi
deploy: js-test test deploy_skiptest
pip_install: require_virtualenv_in_dev
pip install -r requirements.txt
require_virtualenv_in_dev:
@if [[ `whoami` = 'rmc' || "${VIRTUAL_ENV}" = "${HOME}/.virtualenv/rmc" ]]; then \
true; \
else \
echo "ERROR: You are not in the rmc virtualenv"; \
echo "To activate, run:"; \
echo ; \
echo " source ~/.virtualenv/rmc/bin/activate"; \
echo ; \
false; \
fi
stats: require_virtualenv_in_dev
PYTHONPATH=.. python analytics/stats.py
alltest: require_virtualenv_in_dev
PYTHONPATH=..:${SPARK_HOME}/python nosetests -v
test: require_virtualenv_in_dev
PYTHONPATH=..:${SPARK_HOME}/python nosetests -a '!slow' -v
js-test-debug:
cd server/; \
python -c 'import webbrowser; webbrowser.open("http://127.0.0.1:8000/static/js/js_tests/test.html")'; \
python -mSimpleHTTPServer 8000
js-test:
@./js_test.sh; \
if [[ $$? -eq 0 ]]; then \
echo "All JS tests passed"; \
true; \
else \
echo "ERROR: JS tests failed"; \
echo ; \
false; \
fi
clean:
find . -name '*.pyc' -delete
rm -rf server/static/css