Autogenerate makefile help (#12220)
This commit is contained in:
Родитель
89bedc7c78
Коммит
464abd0d2c
5
Makefile
5
Makefile
|
@ -10,10 +10,9 @@ include $(SUB_MAKEFILE)
|
||||||
|
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "Please use 'make <target>' where <target> is one of the following commands."
|
@echo "Please use 'make <target>' where <target> is one of the following commands.\n"
|
||||||
@$(MAKE) help_submake --no-print-directory
|
@$(MAKE) help_submake --no-print-directory
|
||||||
|
@echo "\nCheck the Makefile to know exactly what each target is doing."
|
||||||
@echo "Check the Makefile to know exactly what each target is doing."
|
|
||||||
|
|
||||||
# You probably want to put new commands in Makefile-docker rather than here -
|
# You probably want to put new commands in Makefile-docker rather than here -
|
||||||
# unless they operate on multiple containers or are host-os specific, then
|
# unless they operate on multiple containers or are host-os specific, then
|
||||||
|
|
|
@ -61,29 +61,8 @@ jquery-ui/ui/widgets/sortable.js
|
||||||
help_redirect:
|
help_redirect:
|
||||||
@$(MAKE) help --no-print-directory
|
@$(MAKE) help --no-print-directory
|
||||||
|
|
||||||
.PHONY: help_submake
|
|
||||||
help_submake:
|
|
||||||
@echo " initialize to init the dependencies, the database, and assets"
|
|
||||||
@echo " update to update the dependencies, the database, and assets"
|
|
||||||
@echo " initialize_db to create a new database"
|
|
||||||
@echo " populate_data to populate a new database"
|
|
||||||
@echo " reindex to reindex everything in elasticsearch, for AMO"
|
|
||||||
@echo " update_deps to update the python and node dependencies"
|
|
||||||
@echo " update_db to run the database migrations"
|
|
||||||
@echo " docs to build the documentation"
|
|
||||||
@echo " lint-codestyle to lint the code"
|
|
||||||
@echo " debug to connect for debugging"
|
|
||||||
@echo " djshell to connect to django shell"
|
|
||||||
@echo " dbshell to connect to a database shell"
|
|
||||||
@echo " test to run the entire test suite"
|
|
||||||
@echo " test_es to run the ES tests"
|
|
||||||
@echo " test_failed to rerun the failed tests from the previous run"
|
|
||||||
@echo " test_force_db to run the entire test suite with a new database"
|
|
||||||
@echo " test_no_es to run all but the ES tests"
|
|
||||||
@echo " tdd to run the entire test suite, but stop on the first error"
|
|
||||||
|
|
||||||
.PHONY: initialize_db
|
.PHONY: initialize_db
|
||||||
initialize_db:
|
initialize_db: ## create a new database
|
||||||
rm -rf ./user-media/* ./tmp/*
|
rm -rf ./user-media/* ./tmp/*
|
||||||
$(PYTHON_COMMAND) manage.py create_db --force
|
$(PYTHON_COMMAND) manage.py create_db --force
|
||||||
$(PYTHON_COMMAND) manage.py migrate --noinput --run-syncdb
|
$(PYTHON_COMMAND) manage.py migrate --noinput --run-syncdb
|
||||||
|
@ -94,7 +73,7 @@ initialize_db:
|
||||||
$(PYTHON_COMMAND) manage.py loaddata zadmin/users
|
$(PYTHON_COMMAND) manage.py loaddata zadmin/users
|
||||||
|
|
||||||
.PHONY: populate_data
|
.PHONY: populate_data
|
||||||
populate_data:
|
populate_data: ## populate a new database
|
||||||
# reindex --wipe will force the ES mapping to be re-installed. Useful to
|
# reindex --wipe will force the ES mapping to be re-installed. Useful to
|
||||||
# make sure the mapping is correct before adding a bunch of add-ons.
|
# make sure the mapping is correct before adding a bunch of add-ons.
|
||||||
$(PYTHON_COMMAND) manage.py reindex --wipe --force --noinput
|
$(PYTHON_COMMAND) manage.py reindex --wipe --force --noinput
|
||||||
|
@ -146,10 +125,10 @@ copy_node_js:
|
||||||
for dest in $(NODE_LIBS_JQUERY_UI) ; do cp $(NODE_MODULES)$$dest $(STATIC_JQUERY_UI) ; done
|
for dest in $(NODE_LIBS_JQUERY_UI) ; do cp $(NODE_MODULES)$$dest $(STATIC_JQUERY_UI) ; done
|
||||||
|
|
||||||
.PHONY: update_deps
|
.PHONY: update_deps
|
||||||
update_deps: cleanup_python_build_dir install_python_dev_dependencies install_node_dependencies
|
update_deps: cleanup_python_build_dir install_python_dev_dependencies install_node_dependencies ## update the python and node dependencies
|
||||||
|
|
||||||
.PHONY: update_db
|
.PHONY: update_db
|
||||||
update_db:
|
update_db: ## run the database migrations
|
||||||
./schematic src/olympia/migrations
|
./schematic src/olympia/migrations
|
||||||
|
|
||||||
.PHONY: update_assets
|
.PHONY: update_assets
|
||||||
|
@ -160,10 +139,10 @@ update_assets:
|
||||||
$(PYTHON_COMMAND) manage.py generate_jsi18n_files
|
$(PYTHON_COMMAND) manage.py generate_jsi18n_files
|
||||||
|
|
||||||
.PHONY: update
|
.PHONY: update
|
||||||
update: update_deps update_db update_assets
|
update: update_deps update_db update_assets ## update the dependencies, the database, and assets
|
||||||
|
|
||||||
.PHONY: reindex
|
.PHONY: reindex
|
||||||
reindex:
|
reindex: ## reindex everything in elasticsearch, for AMO
|
||||||
$(PYTHON_COMMAND) manage.py reindex $(ARGS)
|
$(PYTHON_COMMAND) manage.py reindex $(ARGS)
|
||||||
|
|
||||||
.PHONY: setup-ui-tests
|
.PHONY: setup-ui-tests
|
||||||
|
@ -211,52 +190,57 @@ setup-codestyle:
|
||||||
$(PIP_COMMAND) install --progress-bar=off --no-deps --exists-action=w -r requirements/codestyle.txt
|
$(PIP_COMMAND) install --progress-bar=off --no-deps --exists-action=w -r requirements/codestyle.txt
|
||||||
|
|
||||||
.PHONY: lint-codestyle
|
.PHONY: lint-codestyle
|
||||||
lint-codestyle:
|
lint-codestyle: ## lint the code
|
||||||
flake8 src/ services/ tests/
|
flake8 src/ services/ tests/
|
||||||
|
|
||||||
.PHONY: docs
|
.PHONY: docs
|
||||||
docs:
|
docs: ## build the documentation
|
||||||
$(MAKE) -C docs html SPHINXOPTS='-nW'
|
$(MAKE) -C docs html SPHINXOPTS='-nW'
|
||||||
|
|
||||||
.PHONY: debug
|
.PHONY: debug
|
||||||
debug:
|
debug: ## connect for debugging
|
||||||
supervisorctl fg olympia
|
supervisorctl fg olympia
|
||||||
|
|
||||||
.PHONY: djshell
|
.PHONY: djshell
|
||||||
djshell:
|
djshell: ## connect to django shell
|
||||||
$(PYTHON_COMMAND) ./manage.py shell_plus
|
$(PYTHON_COMMAND) ./manage.py shell_plus
|
||||||
|
|
||||||
.PHONY: dbshell
|
.PHONY: dbshell
|
||||||
dbshell:
|
dbshell: ## connect to a database shell
|
||||||
$(PYTHON_COMMAND) ./manage.py dbshell
|
$(PYTHON_COMMAND) ./manage.py dbshell
|
||||||
|
|
||||||
.PHONY: initialize
|
.PHONY: initialize
|
||||||
initialize: update_deps initialize_db update_assets populate_data
|
initialize: update_deps initialize_db update_assets populate_data ## init the dependencies, the database, and assets
|
||||||
|
|
||||||
.PHONY: reload-uwsgi
|
.PHONY: reload-uwsgi
|
||||||
reload-uwsgi:
|
reload-uwsgi: ## force django code reload
|
||||||
uwsgi --reload /code/docker/artifacts/addons-server-uwsgi-master.pid
|
uwsgi --reload /code/docker/artifacts/addons-server-uwsgi-master.pid
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test: ## run the entire test suite
|
||||||
pytest $(APP) $(ARGS)
|
pytest $(APP) $(ARGS)
|
||||||
|
|
||||||
.PHONY: test_es
|
.PHONY: test_es
|
||||||
test_es:
|
test_es: ## run the ES tests
|
||||||
pytest -m es_tests $(APP) $(ARGS)
|
pytest -m es_tests $(APP) $(ARGS)
|
||||||
|
|
||||||
.PHONY: test_no_es
|
.PHONY: test_no_es
|
||||||
test_no_es:
|
test_no_es: ## run all but the ES tests
|
||||||
pytest -m "not es_tests" $(APP) $(ARGS)
|
pytest -m "not es_tests" $(APP) $(ARGS)
|
||||||
|
|
||||||
.PHONY: test_force_db
|
.PHONY: test_force_db
|
||||||
test_force_db:
|
test_force_db: ## run the entire test suite with a new database
|
||||||
pytest --create-db $(APP) $(ARGS)
|
pytest --create-db $(APP) $(ARGS)
|
||||||
|
|
||||||
.PHONY: tdd
|
.PHONY: tdd
|
||||||
tdd:
|
tdd: ## run the entire test suite, but stop on the first error
|
||||||
pytest -x --pdb $(ARGS) $(APP)
|
pytest -x --pdb $(ARGS) $(APP)
|
||||||
|
|
||||||
.PHONY: test_failed
|
.PHONY: test_failed
|
||||||
test_failed:
|
test_failed: ## rerun the failed tests from the previous run
|
||||||
pytest --lf $(ARGS) $(APP)
|
pytest --lf $(ARGS) $(APP)
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: help_submake
|
||||||
|
help_submake:
|
||||||
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||||
|
|
|
@ -5,20 +5,19 @@ help_redirect:
|
||||||
.PHONY: help_submake
|
.PHONY: help_submake
|
||||||
help_submake:
|
help_submake:
|
||||||
@echo "Host only commands:"
|
@echo "Host only commands:"
|
||||||
@echo " shell to connect to a running addons-server docker shell"
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile-os | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||||
@echo " update_docker to update all the docker images"
|
@echo "\nAll other commands will be passed through to the docker 'web' container make:"
|
||||||
@echo "All other commands will be passed through to the docker 'web' container make:"
|
|
||||||
@make -f Makefile-docker help_submake
|
@make -f Makefile-docker help_submake
|
||||||
|
|
||||||
.PHONY: update_docker
|
.PHONY: update_docker
|
||||||
update_docker:
|
update_docker: ## update all the docker images
|
||||||
docker-compose exec worker make update_deps
|
docker-compose exec worker make update_deps
|
||||||
docker-compose exec web make update
|
docker-compose exec web make update
|
||||||
docker-compose restart web
|
docker-compose restart web
|
||||||
docker-compose restart worker
|
docker-compose restart worker
|
||||||
|
|
||||||
.PHONY: shell
|
.PHONY: shell
|
||||||
shell:
|
shell: ## connect to a running addons-server docker shell
|
||||||
docker-compose exec web bash
|
docker-compose exec web bash
|
||||||
|
|
||||||
%: ## This directs any other recipe (command) to the web container's make.
|
%: ## This directs any other recipe (command) to the web container's make.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче