|
4 | 4 | define CHECK_SCRIPT
|
5 | 5 | import sys
|
6 | 6 | if sys.getdefaultencoding() != "utf-8":
|
7 |
| - print "Configure python default encoding to UTF-8" |
8 |
| - sys.exit(1) |
| 7 | + print "Configure python default encoding to UTF-8" |
| 8 | + sys.exit(1) |
9 | 9 | endef
|
10 | 10 | export CHECK_SCRIPT
|
11 | 11 |
|
12 | 12 | # Use make -e DBAAS_DATABASE_HOST=another_host to replace default value
|
13 | 13 |
|
14 | 14 | default:
|
15 |
| - @awk -F\: '/^[a-z_]+:/ && !/default/ {printf "- %-20s %s\n", $$1, $$2}' Makefile |
| 15 | + @awk -F\: '/^[a-z_]+:/ && !/default/ {printf "- %-20s %s\n", $$1, $$2}' Makefile |
16 | 16 |
|
17 | 17 |
|
18 | 18 | clean: # remove temporary files
|
19 |
| - @find . -name \*.pyc -delete |
20 |
| - @find . -name \*.orig -delete |
21 |
| - @find . -name \*.bak -delete |
22 |
| - @find . -name __pycache__ -delete |
23 |
| - @find . -name coverage.xml -delete |
24 |
| - @find . -name test-report.xml -delete |
25 |
| - @find . -name .coverage -delete |
| 19 | + @find . -name \*.pyc -delete |
| 20 | + @find . -name \*.orig -delete |
| 21 | + @find . -name \*.bak -delete |
| 22 | + @find . -name __pycache__ -delete |
| 23 | + @find . -name coverage.xml -delete |
| 24 | + @find . -name test-report.xml -delete |
| 25 | + @find . -name .coverage -delete |
26 | 26 |
|
27 | 27 |
|
28 | 28 | check_environment: # check if your local environment is ok to running this project
|
29 |
| - @echo "$$CHECK_SCRIPT" | python - |
| 29 | + @echo "$$CHECK_SCRIPT" | python - |
30 | 30 |
|
31 | 31 |
|
32 | 32 | pip: # install pip libraries
|
33 |
| - @pip install -r requirements.txt |
34 |
| - @pip install -r requirements_test.txt |
| 33 | + @pip install -r requirements.txt |
| 34 | + @pip install -r requirements_test.txt |
35 | 35 |
|
36 | 36 |
|
37 | 37 | compile:
|
38 |
| - @find . -name "*.py" -exec python -m py_compile {} + |
| 38 | + @find . -name "*.py" -exec python -m py_compile {} + |
39 | 39 |
|
40 | 40 |
|
41 | 41 | db_reset: # drop and create database
|
42 |
| - @mysqladmin -uroot -p$(DBAAS_DATABASE_PASSWORD) -f drop dbaas -hlocalhost; true |
43 |
| - @mysqladmin -uroot -p$(DBAAS_DATABASE_PASSWORD) create dbaas -hlocalhost |
44 |
| - @cd dbaas && python manage.py syncdb --migrate --noinput |
| 42 | + @mysqladmin -uroot -p$(DBAAS_DATABASE_PASSWORD) -f drop dbaas -hlocalhost; true |
| 43 | + @mysqladmin -uroot -p$(DBAAS_DATABASE_PASSWORD) create dbaas -hlocalhost |
| 44 | + @cd dbaas && python manage.py syncdb --migrate --noinput |
45 | 45 |
|
46 | 46 |
|
47 | 47 | load_basic_roles: # load roles
|
48 |
| - @cd dbaas && python manage.py loaddata basic_roles.yaml |
| 48 | + @cd dbaas && python manage.py loaddata basic_roles.yaml |
49 | 49 |
|
50 | 50 |
|
51 | 51 | load_basic_configs: # load roles
|
52 |
| - @cd dbaas && python manage.py loaddata basic_configs.yaml |
| 52 | + @cd dbaas && python manage.py loaddata basic_configs.yaml |
53 | 53 |
|
54 | 54 |
|
55 | 55 | reset_data: db_reset # drop and create database and insert sample data
|
56 |
| - @cd dbaas && python manage.py sample_data |
57 |
| - @cd dbaas && python manage.py loaddata basic_roles.yaml |
58 |
| - @cd dbaas && python manage.py loaddata basic_configs.yaml |
| 56 | + @cd dbaas && python manage.py sample_data |
| 57 | + @cd dbaas && python manage.py loaddata basic_roles.yaml |
| 58 | + @cd dbaas && python manage.py loaddata basic_configs.yaml |
59 | 59 |
|
60 | 60 |
|
61 | 61 | run_migrate: # run all migrations
|
62 |
| - @cd dbaas && python manage.py syncdb --migrate --noinput |
| 62 | + @cd dbaas && python manage.py syncdb --migrate --noinput |
63 | 63 |
|
64 | 64 |
|
65 | 65 | test: # run tests
|
66 |
| - @mysqladmin -uroot -p$(DBAAS_DATABASE_PASSWORD) -f drop test_dbaas -h$(DBAAS_DATABASE_HOST); true |
67 |
| - @cd dbaas && python manage.py test --traceback $(filter-out $@,$(MAKECMDGOALS)) |
| 66 | + @mysqladmin -uroot -p$(DBAAS_DATABASE_PASSWORD) -f drop test_dbaas -h$(DBAAS_DATABASE_HOST); true |
| 67 | + @cd dbaas && python manage.py test --traceback $(filter-out $@,$(MAKECMDGOALS)) |
68 | 68 |
|
69 | 69 |
|
70 | 70 | run: # run local server
|
71 |
| - @cd dbaas && python manage.py runserver 0.0.0.0:8000 $(filter-out $@,$(MAKECMDGOALS)) |
| 71 | + @cd dbaas && python manage.py runserver 0.0.0.0:8000 $(filter-out $@,$(MAKECMDGOALS)) |
72 | 72 |
|
73 | 73 |
|
74 | 74 | run_celery: # run local celery
|
75 |
| - @cd dbaas && python manage.py celery worker -E --loglevel=DEBUG --app=dbaas --beat $(filter-out $@,$(MAKECMDGOALS)) |
| 75 | + @cd dbaas && python manage.py celery worker -E --loglevel=DEBUG --app=dbaas --beat $(filter-out $@,$(MAKECMDGOALS)) |
76 | 76 |
|
77 | 77 |
|
78 | 78 | shell: # run django shell
|
79 |
| - @cd dbaas && python manage.py shell_plus --use-pythonrc |
| 79 | + @cd dbaas && python manage.py shell_plus --use-pythonrc |
80 | 80 |
|
81 | 81 |
|
82 | 82 | update_permissions:
|
83 |
| - @cd dbaas && python manage.py update_permissions |
| 83 | + @cd dbaas && python manage.py update_permissions |
84 | 84 |
|
85 | 85 |
|
86 | 86 | physical_migrate: # create migration to physical app
|
87 |
| - @cd dbaas && python manage.py schemamigration physical --auto |
| 87 | + @cd dbaas && python manage.py schemamigration physical --auto |
88 | 88 |
|
89 | 89 |
|
90 | 90 | tsuru_migrate: # create migration to tsuru app
|
91 |
| - @cd dbaas && python manage.py schemamigration tsuru --auto |
| 91 | + @cd dbaas && python manage.py schemamigration tsuru --auto |
92 | 92 |
|
93 | 93 |
|
94 | 94 | logical_migrate: # create migration to logical app
|
95 |
| - @cd dbaas && python manage.py schemamigration logical --auto |
| 95 | + @cd dbaas && python manage.py schemamigration logical --auto |
96 | 96 |
|
97 | 97 |
|
98 | 98 | graph_models: # generate graph models
|
99 |
| - @cd dbaas && python manage.py graph_models -g physical logical tsuru > ~/dbaas_model.dot |
100 |
| - |
| 99 | + @cd dbaas && python manage.py graph_models -g physical logical tsuru > ~/dbaas_model.dot |
0 commit comments