From c1205e7c47d008b85a7b2df24648439940146765 Mon Sep 17 00:00:00 2001 From: JensDiemer Date: Tue, 22 Dec 2020 18:55:11 +0100 Subject: [PATCH] local test via Makefile --- .gitignore | 1 + Makefile | 36 ++++++++++++++++++++++++++++++++++++ README.md | 22 +++++++++++----------- manifest.json | 2 +- pyproject.toml | 16 ++++++++++++++++ 5 files changed, 65 insertions(+), 12 deletions(-) create mode 100644 Makefile create mode 100644 pyproject.toml diff --git a/.gitignore b/.gitignore index a7c2f58..d18d5cc 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ __pycache__ secret.txt /local_test/ +/poetry.lock diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2edd58a --- /dev/null +++ b/Makefile @@ -0,0 +1,36 @@ +SHELL := /bin/bash + +all: help + +help: + @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9 -]+:.*?## / {printf "\033[36m%-22s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) + +check-poetry: + @if [[ "$(shell poetry --version 2>/dev/null)" == *"Poetry"* ]] ; \ + then \ + echo "Poetry found, ok." ; \ + else \ + echo 'Please install poetry first, with e.g.:' ; \ + echo 'make install-poetry' ; \ + exit 1 ; \ + fi + +install-poetry: ## install or update poetry + pip3 install -U poetry + +install: check-poetry ## install project via poetry + poetry install + +update: install-poetry ## update the sources and installation + poetry update + +local-test: check-poetry ## Run local_test.py to run the project locally + poetry run ./local_test.py + +local-diff-settings: ## Run "manage.py diffsettings" with local test + poetry run python3 local_test/opt_yunohost/manage.py diffsettings + + +############################################################################## + +.PHONY: help check-poetry install-poetry install update local-test \ No newline at end of file diff --git a/README.md b/README.md index 2d0b2d4..e7fac34 100644 --- a/README.md +++ b/README.md @@ -111,20 +111,20 @@ For quicker developing of Django-For-Runners in the context of YunoHost app, it's possible to run the Django developer server with the settings and urls made for YunoHost installation. -For this, just run `local_test.py` in a Django-For-Runners virtualenv. - e.g.: ```bash -~$ git clone https://github.com/jedie/Django-For-Runners.git ~$ git clone https://github.com/YunoHost-Apps/django-for-runners_ynh.git -~$ cd Django-For-Runners/ -~/Django-For-Runners$ make install -~/Django-For-Runners$ poetry shell -(django-for-runners-yd_5sxYx-py3.8) ~/Django-For-Runners$ cd ../django-for-runners_ynh/ -(django-for-runners-yd_5sxYx-py3.8) ~/django-for-runners_ynh$ ./local_test.py -... -Django version 2.2.17, using settings 'ynh_django-for-runners_settings' -Starting development server at http://127.0.0.1:8000/ +~$ cd django-for-runners_ynh/ +~/django-for-runners_ynh$ make +install-poetry install or update poetry +install install project via poetry +update update the sources and installation +local-test Run local_test.py to run the project locally +local-diff-settings Run "manage.py diffsettings" with local test + +~/django-for-runners_ynh$ make install-poetry +~/django-for-runners_ynh$ make install +~/django-for-runners_ynh$ make local-test ``` Notes: diff --git a/manifest.json b/manifest.json index 71f217f..c9bd2f3 100644 --- a/manifest.json +++ b/manifest.json @@ -5,7 +5,7 @@ "description": { "en": "Store your GPX tracks of your running (or other sports activity)" }, - "version": "0.12.0rc2~ynh1", + "version": "0.12.0rc2~ynh2", "url": "https://github.com/jedie/django-for-runners", "license": "GPL-3.0", "maintainer": { diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..4d17b07 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,16 @@ +[tool.poetry] +name = "django-for-runners_ynh" +version = "0.12.0rc2~ynh2" +description = "Test django-for-runners_ynh via local_test.py" +authors = ["JensDiemer "] +license = "GPL" + +[tool.poetry.dependencies] +python = ">=3.7,<4.0.0" +django-for-runners = "*" + +[tool.poetry.dev-dependencies] + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api"