forked from dynaconf/dynaconf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
163 lines (143 loc) · 7.16 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
SHELL := /bin/bash
.PHONY: all clean dist docs install pep8 publish run-pre-commit run-tox setup-pre-commit test test_examples test_only test_redis test_vault help coverage-report
help:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
all: clean install run-pre-commit test test_examples coverage-report
test_examples:
@echo '############### Chdir to example directory ###############'
cd example/common;pwd;python program.py
cd example/common-encoding;pwd;python program.py
cd example/;pwd;python full_example.py
cd example/;pwd;python compat.py
cd example/app;pwd;python app.py
cd example/dunder;pwd;python app.py
cd example/app_with_dotenv;pwd;python app.py
cd example/merge_enabled;pwd;python app.py
cd example/new_merge;pwd;python app.py
cd example/dynaconf_merge;pwd;python app.py
cd example/multiple_sources;pwd;python app.py
cd example/multiple_folders;pwd;python app.py
cd example/toml_example/;pwd;python app.py
cd example/yaml_example/settings_file/;pwd;python app.py
cd example/yaml_example/yaml_as_extra_config/;pwd;python app.py
cd example/flask_with_dotenv;pwd;flask routes | grep -c flask_with_dotenv || exit 1
cd example/flask_with_toml;pwd;flask routes | grep -c flask_with_toml || exit 1
cd example/flask_with_yaml;pwd;flask routes | grep -c flask_with_yaml || exit 1
cd example/flask_with_json;pwd;flask routes | grep -c flask_with_json || exit 1
cd example/flask_with_commentjson;pwd;flask routes | grep -c flask_with_commentjson || exit 1
cd example/flask_with_ini;pwd;flask routes | grep -c flask_with_ini || exit 1
cd example/validators/with_python/;pwd;python app.py
cd example/validators/with_toml/;pwd;dynaconf validate
cd example/toml_with_secrets/;pwd;python program.py
cd example/envs;pwd;python app.py
cd example/custom_loader;pwd;python app.py
cd example/get_fresh;pwd;python app.py
cd example/includes;pwd;python app.py
cd example/jenkins_secrets_file;pwd;python app.py
cd example/specific_settings_files;pwd;python app.py
cd example/django_example/;pwd;python manage.py test polls -v 2
cd example/django_example_compat/;pwd;python manage.py test polls -v 2
cd example/django_example/;pwd;PYTHONPATH=. DJANGO_SETTINGS_MODULE=foo.settings django-admin test polls -v 2
cd example/project_root/;pwd;rm -rf /tmp/dynaconf_project_root_test/settings.py;mkdir -p /tmp/dynaconf_project_root_test/;echo "MESSAGE = 'Hello from tmp'" > /tmp/dynaconf_project_root_test/settings.py;python app.py;rm -rf /tmp/dynaconf_project_root_test/
cd example/settings_file/;pwd;rm -rf /tmp/settings_file_test/settings.py;mkdir -p /tmp/settings_file_test/;echo "MESSAGE = 'Hello from tmp'" > /tmp/settings_file_test/settings.py;python app.py;rm -rf /tmp/settings_file_test/
cd example/configure/;pwd;rm -rf /tmp/configure_test/settings.py;mkdir -p /tmp/configure_test/;echo "MESSAGE = 'Hello from tmp'" > /tmp/configure_test/settings.py;python app.py;rm -rf /tmp/configure_test/
@echo '############### Calling from outer folder ###############'
python example/common/program.py
python example/common-encoding/program.py
python example/full_example.py
python example/compat.py
python example/app/app.py
python example/app_with_dotenv/app.py
python example/merge_enabled/app.py
python example/dynaconf_merge/app.py
python example/multiple_sources/app.py
python example/multiple_folders/app.py
python example/toml_example/app.py
python example/yaml_example/settings_file/app.py
python example/yaml_example/yaml_as_extra_config/app.py
python example/validators/with_python/app.py
python example/toml_with_secrets/program.py
python example/envs/app.py
python example/custom_loader/app.py
python example/get_fresh/app.py
python example/includes/app.py
python example/jenkins_secrets_file/app.py
python example/specific_settings_files/app.py
python example/django_example/manage.py test polls -v 2
PYTHONPATH=example/django_example DJANGO_SETTINGS_MODULE=foo.settings python example/django_example/standalone_script.py
PYTHONPATH=example/django_example_compat DJANGO_SETTINGS_MODULE=foo.settings python example/django_example_compat/standalone_script.py
python example/envvar_prefix/app.py
@echo '############### Django Admin From root folder ###############'
PYTHONPATH=./example/django_example/ DJANGO_SETTINGS_MODULE=foo.settings django-admin test polls -v 2
PYTHONPATH=./example/django_example_compat/ DJANGO_SETTINGS_MODULE=foo.settings django-admin test polls -v 2
@echo '############ Issues ##################'
cd example/issues/160_path_traversal_fixed;pwd;./test.sh
cd example/issues/166_renamed_global_env;pwd;python app.py
cd example/issues/169_renamed_settings_module;pwd;python app.py
cd example/issues/182_multiple_locations;pwd;python app.py
cd example/issues/184_ipython;pwd;./test.sh
cd example/issues/194_flask_config;pwd;python app.py
cd example/issues/228_nested_toml_bool/python_app;pwd;python app.py
cd example/issues/228_nested_toml_bool/django_app;pwd;python manage.py test
test_vault:
# @cd example/vault;pwd;python write.py
# docker run -d -e 'VAULT_DEV_ROOT_TOKEN_ID=myroot' -p 8200:8200 vault
@cd example/vault;pwd;dynaconf write vault -s SECRET=vault_works_in_default -s FOO=foo_is_default
@cd example/vault;pwd;dynaconf write vault -e dev -s SECRET=vault_works_in_dev
@cd example/vault;pwd;dynaconf write vault -e prod -s SECRET=vault_works_in_prod
@sleep 5
@cd example/vault;pwd;python vault_example.py
test_redis:
# @cd example/redis_example;pwd;python write.py
# docker run -d -p 6379:6379 redis
@cd example/redis_example;pwd;dynaconf write redis -s FOO=foo_is_default
@cd example/redis_example;pwd;dynaconf write redis -s SECRET=redis_works_in_default
@cd example/redis_example;pwd;dynaconf write redis -e development -s SECRET=redis_works_in_development
@cd example/redis_example;pwd;dynaconf write redis -e production -s SECRET=redis_works_in_production
@sleep 5
@cd example/redis_example;pwd;python redis_example.py
test_only:
py.test -v --cov-config .coveragerc --cov=dynaconf -l --tb=short --maxfail=1 tests/
coverage xml
coverage-report:
coverage report --fail-under=100
test: pep8 test_only
install:
pip install --upgrade pip
python setup.py develop
pip install -r requirements_dev.txt
make setup-pre-commit
setup-pre-commit:
pre-commit install
pre-commit install-hooks
run-pre-commit:
rm -rf .tox/
pre-commit run --files $$(find -regex '.*\.\(py\|yaml\|yml\|md\)') -v
pep8:
# Flake8 ignores
# F841 (local variable assigned but never used, useful for debugging on exception)
# W504 (line break after binary operator, I prefer to put `and|or` at the end)
# F403 (star import `from foo import *` often used in __init__ files)
flake8 dynaconf --ignore=F403,W504,W503,F841,E401,F401,E402
dist: clean
@python setup.py sdist bdist_wheel
publish:
make run-tox
@twine upload dist/*
clean:
@find ./ -name '*.pyc' -exec rm -f {} \;
@find ./ -name 'Thumbs.db' -exec rm -f {} \;
@find ./ -name '*~' -exec rm -f {} \;
rm -rf .cache
rm -rf build
rm -rf dist
rm -rf *.egg-info
rm -rf htmlcov
rm -rf .tox/
rm -rf docs/_build
docs:
rm -rf docs/_build
@cd docs;make html
run-tox:
tox -r
rm -rf .tox