local test via Makefile

This commit is contained in:
JensDiemer 2020-12-22 18:55:11 +01:00
parent a5cc74340c
commit c1205e7c47
5 changed files with 65 additions and 12 deletions

1
.gitignore vendored
View file

@ -5,3 +5,4 @@
__pycache__ __pycache__
secret.txt secret.txt
/local_test/ /local_test/
/poetry.lock

36
Makefile Normal file
View file

@ -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

View file

@ -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 it's possible to run the Django developer server with the settings
and urls made for YunoHost installation. and urls made for YunoHost installation.
For this, just run `local_test.py` in a Django-For-Runners virtualenv.
e.g.: e.g.:
```bash ```bash
~$ git clone https://github.com/jedie/Django-For-Runners.git
~$ git clone https://github.com/YunoHost-Apps/django-for-runners_ynh.git ~$ git clone https://github.com/YunoHost-Apps/django-for-runners_ynh.git
~$ cd Django-For-Runners/ ~$ cd django-for-runners_ynh/
~/Django-For-Runners$ make install ~/django-for-runners_ynh$ make
~/Django-For-Runners$ poetry shell install-poetry install or update poetry
(django-for-runners-yd_5sxYx-py3.8) ~/Django-For-Runners$ cd ../django-for-runners_ynh/ install install project via poetry
(django-for-runners-yd_5sxYx-py3.8) ~/django-for-runners_ynh$ ./local_test.py update update the sources and installation
... local-test Run local_test.py to run the project locally
Django version 2.2.17, using settings 'ynh_django-for-runners_settings' local-diff-settings Run "manage.py diffsettings" with local test
Starting development server at http://127.0.0.1:8000/
~/django-for-runners_ynh$ make install-poetry
~/django-for-runners_ynh$ make install
~/django-for-runners_ynh$ make local-test
``` ```
Notes: Notes:

View file

@ -5,7 +5,7 @@
"description": { "description": {
"en": "Store your GPX tracks of your running (or other sports activity)" "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", "url": "https://github.com/jedie/django-for-runners",
"license": "GPL-3.0", "license": "GPL-3.0",
"maintainer": { "maintainer": {

16
pyproject.toml Normal file
View file

@ -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 <git@jensdiemer.de>"]
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"