[odrs-web] Add a simple Makefile which allows us to run the ODRS locally easily



commit 67b08d883c9a8f61f99ad9ce2f11abe1956dcece
Author: Richard Hughes <richard hughsie com>
Date:   Wed Jun 26 13:08:22 2019 +0100

    Add a simple Makefile which allows us to run the ODRS locally easily

 app_data/.gitignore       |  3 +++
 app_data/Makefile         | 43 +++++++++++++++++++++++++++++++++++++++++++
 app_data/requirements.txt |  2 ++
 3 files changed, 48 insertions(+)
---
diff --git a/app_data/.gitignore b/app_data/.gitignore
new file mode 100644
index 0000000..76803bf
--- /dev/null
+++ b/app_data/.gitignore
@@ -0,0 +1,3 @@
+.coverage
+env
+htmlcov
diff --git a/app_data/Makefile b/app_data/Makefile
new file mode 100644
index 0000000..0788180
--- /dev/null
+++ b/app_data/Makefile
@@ -0,0 +1,43 @@
+# Copyright (C) 2019 Richard Hughes <richard hughsie com>
+# SPDX-License-Identifier: GPL-2.0+
+
+VENV=./env
+PYTHON=$(VENV)/bin/python
+PYTEST=$(VENV)/bin/pytest
+FLASK=$(VENV)/bin/flask
+
+setup: requirements.txt
+       virtualenv ./env
+       $(VENV)/bin/pip install -r requirements.txt
+
+clean:
+       rm -rf ./build
+       rm -rf ./htmlcov
+
+run:
+       ODRS_REVIEWS_SECRET=1 \
+       FLASK_APP=odrs/__init__.py \
+       HOME=/home/hughsie/Code/odrs-web/app_data \
+       $(VENV)/bin/flask run
+       #FLASK_DEBUG=1
+
+dbup:
+       ODRS_CONFIG=example.cfg \
+       FLASK_APP=odrs/__init__.py \
+       $(FLASK) db upgrade
+
+dbdown:
+       ODRS_CONFIG=example.cfg \
+       FLASK_APP=odrs/__init__.py \
+       $(FLASK) db downgrade
+
+dbmigrate:
+       ODRS_CONFIG=example.cfg \
+       FLASK_APP=odrs/__init__.py \
+       $(FLASK) db migrate
+
+check: $(PYTEST)
+       $(PYTEST) \
+               --cov=odrs \
+               --cov-report=html
+       $(PYTHON) ./pylint_test.py
diff --git a/app_data/requirements.txt b/app_data/requirements.txt
index 10d7eeb..f439a4b 100644
--- a/app_data/requirements.txt
+++ b/app_data/requirements.txt
@@ -2,3 +2,5 @@ flask-wtf
 flask-login
 markupsafe
 PyMySQL
+pylint
+pytest-cov


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]