diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-01-27 18:21:55 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-07-01 18:01:59 +0200 |
commit | 49e64486eb885cf1e57edf921ac54dd6a09bf744 (patch) | |
tree | ac58e393f88bd034eb8108905a7a43cc6c5498f6 /Makefile.example | |
parent | f1c39260f07f87532ab194899b27e289e5cb558a (diff) | |
download | Ishtar-49e64486eb885cf1e57edf921ac54dd6a09bf744.tar.bz2 Ishtar-49e64486eb885cf1e57edf921ac54dd6a09bf744.zip |
Pseudo-squash of migrations - use Makefile script for migrations
Diffstat (limited to 'Makefile.example')
-rw-r--r-- | Makefile.example | 148 |
1 files changed, 85 insertions, 63 deletions
diff --git a/Makefile.example b/Makefile.example index fc62e84d2..2605b559a 100644 --- a/Makefile.example +++ b/Makefile.example @@ -10,63 +10,60 @@ apps="ishtar_common" "archaeological_operations" "archaeological_context_records default_data='fr' version=`head -n 1 version.py | cut -d' ' -f2` branch_name=`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/"` +BRANCH_NAME := $(shell git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/") -help: - # Actions available: - # * clean: remove temporary files - # * update: - # * test: - # * pep8: - # * pylint: - # * syncdb: - # * run: - # * runcelery: - # * shell: - # * makemessages: - # * compilemessages: - # * sass: - # * schemamigrations: - # * schemamigrations_initial: - # * generate_doc: - # * fixtures: - # * fixtures_*: - # * translations_push: - # * translations_pull: - # * readme_md_to_rst: - # * sdist: - # * distribute_test: - # * distribute_main: - # * deb: - -clean: +## Check dependencies + +help: ## Display this help + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) + +##@ Cleanup + +clean: ## remove temporary files -rm -rf *~* -find . -name '*.pyc' -exec rm {} \; -find . -name '.*.swp' -exec rm {} \; -find . -name '__pycache__' -exec rm -rf {} \; 2> /dev/null -rm -rf dist ishtar.egg-info -update: clean syncdb compilemessages collectstatic +##@ General management + +update: clean syncdb compilemessages collectstatic ## update the instance + +migrate: ## migrate database + cd $(project); $(PYTHON) manage.py migrate + +compilemessages: ## compile translations + cd $(CURDIR); \ + $(PYTHON) $(project)/manage.py compilemessages; \ + +collectstatic: ## collect all static files + cd $(project);$(PYTHON) manage.py collectstatic --noinput + +##@ Development: build/tests -test: clean +test: clean ## launch tests cd $(project); $(PYTHON) manage.py test $(apps) -soft_test: clean +soft_test: clean ## launch tests without database regeneration cd $(project); $(PYTHON) manage.py test -k $(apps) -coverage: clean - cd $(project); coverage run --source="ishtar_common,archaeological_operations,\ - archaeological_context_records,archaeological_files,archaeological_finds,archaeological_warehouse,\ - archaeological_files_pdl" ./manage.py test $(apps) && coverage report - -build_gitlab: clean collectstatic +build_gitlab: clean collectstatic ## specific build for gitlab cd $(project); $(PYTHON) ./manage.py migrate -test_gitlab: build_gitlab +test_gitlab: build_gitlab ## cd $(project); $(PYTHON) manage.py test $(apps) soft_test_gitlab: build_gitlab cd $(project); $(PYTHON) manage.py -k test $(apps) +##@ Development: checks + +coverage: clean ## launch test coverage + cd $(project); coverage run --source="ishtar_common,archaeological_operations,\ + archaeological_context_records,archaeological_files,archaeological_finds,archaeological_warehouse,\ + archaeological_files_pdl" ./manage.py test $(apps) && coverage report + pep8: pep8 --filename=*.py --ignore=W --exclude="manage.py,settings.py,migrations" --statistics --repeat . @@ -75,53 +72,47 @@ pylint: pylint "$(CURDIR)/$$DIR" --ignore=.git,migrations --max-public-methods=50 --ignored-classes=Item.Meta --method-rgx='[a-z_][a-z0-9_]{2,40}$$'; \ done -migrate: - cd $(project); $(PYTHON) manage.py migrate +##@ Development: run shell: cd $(project);$(PYTHON) manage.py shell -run: +run: ## run test server cd $(project); $(PYTHON) manage.py runserver 0.0.0.0:8000 runcelery: celery -A example_project worker -l info -makemessages: - for DIR in $(apps); do \ - cd $(CURDIR)/$$DIR; \ - $(PYTHON) ../$(project)/manage.py makemessages --all; \ - msgfilter -i locale/fr/LC_MESSAGES/django.po sed -e d | sed -e "s/fuzzy//g" > locale/django.pot ;\ - done +##@ Development: translations -compilemessages: - for DIR in $(apps); do \ - cd $(CURDIR)/$$DIR; \ - $(PYTHON) ../$(project)/manage.py compilemessages; \ - done +makemessages: + cd $(CURDIR); \ + $(PYTHON) $(project)/manage.py makemessages --all; \ + #msgfilter -i locale/fr/LC_MESSAGES/django.po sed -e d | sed -e "s/fuzzy//g" > locale/django.pot ;\ -collectstatic: - cd $(project);$(PYTHON) manage.py collectstatic --noinput +##@ Development: database migrations: cd $(project);\ - for APP in $(apps); do \ + for APP in "overload_translation" $(apps); do \ echo "* makemigrations for "$$APP; \ $(PYTHON) ./manage.py makemigrations $$APP; \ done generate_doc: cd $(project);\ - $(PYTHON) manage.py graph_models --pydot -g -I "ImporterModel,ImporterType,ImporterDefault,ImporterDefaultValues,ImporterColumn,ValueFormater,Regexp,ImportTarget,FormaterType,Import" ishtar_common > /tmp/ishtar-imports.dot ;\ - dot -Tpng /tmp/ishtar-imports.dot -o ../docs/source/_static/db-imports.png + $(PYTHON) manage.py graph_models --pydot -g -I "ImporterModel,ImporterType,ImporterDefault,ImporterDefaultValues,ImporterColumn,Regexp,ImportTarget,FormaterType,Import" ishtar_common > /tmp/ishtar-imports.dot ;\ + dot -Tsvg /tmp/ishtar-imports.dot -o ../docs/source/_static/db-imports.svg rm /tmp/ishtar-imports.dot cd $(project);\ for APP in $(apps); do \ $(PYTHON) manage.py graph_models -g --pydot $$APP > /tmp/ishtar-$$APP.dot; \ - dot -Tpng /tmp/ishtar-$$APP.dot -o ../docs/source/_static/db-$$APP.png; \ + dot -Tsvg /tmp/ishtar-$$APP.dot -o ../docs/source/_static/db-$$APP.svg; \ rm /tmp/ishtar-$$APP.dot ; \ done +##@ Manage fixtures + fixtures: fixtures_auth fixtures_common fixtures_operations fixtures_context_records fixtures_finds fixtures_warehouse fixtures_files fixtures_auth: @@ -140,6 +131,7 @@ fixtures_common: fixtures_common_importers fixtures_spatialrefsystem ishtar_common.titletype \ ishtar_common.supporttype \ ishtar_common.format \ + ishtar_common.documenttemplate \ > '../ishtar_common/fixtures/initial_data-'$(default_data)'.json' fixtures_common_importers: @@ -234,11 +226,6 @@ fixtures_files: archaeological_files.permittype \ > '../archaeological_files/fixtures/initial_data-'$(default_data)'.json' -translations_push: makemessages - zanata-cli push --project-config zanata.xml --project-version $(branch_name) - -translations_pull: - zanata-cli pull --project-config zanata.xml --project-version $(branch_name) readme_md_to_rst: pandoc --from=markdown --to=rst --output=README.rst README.md @@ -274,3 +261,38 @@ push_install: clean sass: ./node_modules/node-sass/bin/node-sass scss/custom.scss --output-style compressed > ishtar_common/static/bootstrap/bootstrap.css + +sass_watch: + ./node_modules/node-sass/bin/node-sass --watch scss/custom.scss --output-style compressed > ishtar_common/static/bootstrap/bootstrap.css + +transition_migrate: + cd $(project); \ + $(PYTHON) manage.py migrate ishtar_common 0117 ; \ + $(PYTHON) manage.py migrate archaeological_files 0024 ; \ + $(PYTHON) manage.py migrate archaeological_operations 0075 ; \ + $(PYTHON) manage.py migrate archaeological_context_records 0056 ; \ + $(PYTHON) manage.py migrate archaeological_finds 0080 ; \ + $(PYTHON) manage.py migrate archaeological_warehouse 0044 ; \ + $(PYTHON) manage.py migrate --fake ishtar_common 0201 ; \ + $(PYTHON) manage.py migrate --fake archaeological_files 0101 ; \ + $(PYTHON) manage.py migrate --fake archaeological_operations 0102 ; \ + $(PYTHON) manage.py migrate --fake archaeological_context_records 0102 ; \ + $(PYTHON) manage.py migrate --fake archaeological_finds 0102 ; \ + $(PYTHON) manage.py migrate --fake archaeological_warehouse 0101 ; + +new_migration: + cd $(project); \ + $(PYTHON) manage.py migrate contenttypes ; \ + $(PYTHON) manage.py migrate admin ; \ + $(PYTHON) manage.py migrate auth ; \ + $(PYTHON) manage.py migrate authtoken ; \ + $(PYTHON) manage.py migrate registration ; \ + $(PYTHON) manage.py migrate sessions ; \ + $(PYTHON) manage.py migrate sites ; \ + $(PYTHON) manage.py migrate --fake ishtar_common 0117 ; \ + $(PYTHON) manage.py migrate --fake archaeological_files 0024 ; \ + $(PYTHON) manage.py migrate --fake archaeological_operations 0075 ; \ + $(PYTHON) manage.py migrate --fake archaeological_context_records 0056 ; \ + $(PYTHON) manage.py migrate --fake archaeological_finds 0080 ; \ + $(PYTHON) manage.py migrate --fake archaeological_warehouse 0044 ; \ + $(PYTHON) manage.py migrate ; |