-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
35 lines (27 loc) · 1.09 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
MYSQL_USER=
MYSQL_PASS=
MYSQL_DB=dev_visiblegovernment
HOSTNAME=localhost
DATASET_DB=`ls -1 dataset/*.sql.bz2 | tail -n1`
.PHONY: createdb cleardb loaddb data vizdata
info:
@echo VisibleGovernment - Spendings Visualization Makefile
@echo
@echo "createdb - creates the database"
@echo "cleardb - clears the data in the database"
@echo "loaddb - loads the last .sql snapshot in dataset/"
@echo "data - runs the 'collect.py' script to process the data"
@echo "vizdata - copies the processed data to the viz directory"
@echo
@echo "To run the visualization, 'cd viz ; pamela-web' (you need Pamela)"
createdb:
echo "create database $(MYSQL_DB) ; grant all privileges on $(MYSQL_DB).* to '$(MYSQL_USER)'@'$(HOSTNAME)';" | mysql -uroot -p ; true
cleardb:
mysqldump -u$(MYSQL_USER) -p$(MYSQL_PASS) --add-drop-table --no-data $(MYSQL_DB) | grep ^DROP | mysql -u$(MYSQL_USER) -p$(MYSQL_PASS) -D$(MYSQL_DB) ; true
loaddb: createdb cleardb
bunzip2 -c $(DATASET_DB) | mysql -u$(MYSQL_USER) -p$(MYSQL_PASS) -D$(MYSQL_DB)
data:
python collect.py
vizdata: data
cp dataset/*.json viz/data/
# EOF