mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-28 17:32:38 +02:00
Create a Makefile to ease development
This commit is contained in:
parent
a354973f1f
commit
d1facecc69
7 changed files with 60 additions and 38 deletions
39
Makefile
Normal file
39
Makefile
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
VIRTUALENV = virtualenv --python=python3
|
||||||
|
SPHINX_BUILDDIR = docs/_build
|
||||||
|
VENV := $(shell echo $${VIRTUAL_ENV-.venv})
|
||||||
|
PYTHON = $(VENV)/bin/python3
|
||||||
|
DEV_STAMP = $(VENV)/.dev_env_installed.stamp
|
||||||
|
DOC_STAMP = $(VENV)/.doc_env_installed.stamp
|
||||||
|
INSTALL_STAMP = $(VENV)/.install.stamp
|
||||||
|
TEMPDIR := $(shell mktemp -d)
|
||||||
|
|
||||||
|
all: install
|
||||||
|
install: $(INSTALL_STAMP)
|
||||||
|
$(INSTALL_STAMP):
|
||||||
|
$(VENV)/bin/pip install -U pip
|
||||||
|
$(VENV)/bin/pip install -r requirements.txt
|
||||||
|
touch $(INSTALL_STAMP)
|
||||||
|
|
||||||
|
virtualenv: $(PYTHON)
|
||||||
|
$(PYTHON):
|
||||||
|
$(VIRTUALENV) $(VENV)
|
||||||
|
|
||||||
|
install-dev: $(INSTALL_STAMP) $(DEV_STAMP)
|
||||||
|
$(DEV_STAMP): $(PYTHON) dev-requirements.txt
|
||||||
|
$(VENV)/bin/pip install -Ur dev-requirements.txt
|
||||||
|
touch $(DEV_STAMP)
|
||||||
|
|
||||||
|
serve: $(INSTALL_STAMP)
|
||||||
|
cd budget; ../$(PYTHON) run.py
|
||||||
|
|
||||||
|
test: $(DEV_STAMP)
|
||||||
|
cd budget; ../$(PYTHON) tests.py
|
||||||
|
|
||||||
|
release: $(DEV_STAMP)
|
||||||
|
$(VENV)/bin/fullrelease
|
||||||
|
|
||||||
|
build-requirements:
|
||||||
|
$(VIRTUALENV) $(TEMPDIR)
|
||||||
|
$(TEMPDIR)/bin/pip install -U pip
|
||||||
|
$(TEMPDIR)/bin/pip install -Ue "."
|
||||||
|
$(TEMPDIR)/bin/pip freeze | grep -v -- '-e' > requirements.txt
|
1
Procfile
1
Procfile
|
@ -1 +0,0 @@
|
||||||
web: python budget/run.py
|
|
40
README.rst
40
README.rst
|
@ -16,13 +16,9 @@ LICENSE for more details).
|
||||||
Make it run!
|
Make it run!
|
||||||
============
|
============
|
||||||
|
|
||||||
To make it run, you just have to do something like::
|
To make it run, you just have to do use the serve command::
|
||||||
|
|
||||||
$ virtualenv venv
|
$ make serve
|
||||||
$ source venv/bin/activate
|
|
||||||
$ pip install -r budget/requirements.txt
|
|
||||||
$ cd budget
|
|
||||||
$ python run.py
|
|
||||||
|
|
||||||
It is also better to actually turn the debugging mode on when you're
|
It is also better to actually turn the debugging mode on when you're
|
||||||
developing. You can create a `settings.py` file in the `budget` directory, with
|
developing. You can create a `settings.py` file in the `budget` directory, with
|
||||||
|
@ -37,11 +33,7 @@ You can also set the `TESTING` flag to `True` so no mails are sent
|
||||||
Deploy it
|
Deploy it
|
||||||
=========
|
=========
|
||||||
|
|
||||||
To deploy it, I'm using gunicorn and supervisord::
|
To deploy it, I'm using gunicorn and supervisord.
|
||||||
|
|
||||||
$ virtualenv venv
|
|
||||||
$ source venv/bin/activate
|
|
||||||
$ pip install -r requirements.txt
|
|
||||||
|
|
||||||
1. Add the lines in conf/supervisord.conf to your supervisord.conf file.
|
1. Add the lines in conf/supervisord.conf to your supervisord.conf file.
|
||||||
**adapt them to your paths!**
|
**adapt them to your paths!**
|
||||||
|
@ -58,9 +50,8 @@ e.g:
|
||||||
|
|
||||||
APPLICATION_ROOT='/budget'
|
APPLICATION_ROOT='/budget'
|
||||||
|
|
||||||
|
The REST API?
|
||||||
How about the REST API?
|
=============
|
||||||
=======================
|
|
||||||
|
|
||||||
Yep, you're right, there is a REST API with this. Head to the `api
|
Yep, you're right, there is a REST API with this. Head to the `api
|
||||||
documentation <https://ihatemoney.readthedocs.io/en/latest/api.html>`_ to know more.
|
documentation <https://ihatemoney.readthedocs.io/en/latest/api.html>`_ to know more.
|
||||||
|
@ -68,22 +59,22 @@ documentation <https://ihatemoney.readthedocs.io/en/latest/api.html>`_ to know m
|
||||||
How to contribute
|
How to contribute
|
||||||
=================
|
=================
|
||||||
|
|
||||||
|
You would like to contribute? First, thanks a bunch! This project is a small
|
||||||
|
project with just a few people behind it, so any help is appreciated!
|
||||||
|
|
||||||
There are different ways to help us, regarding if you are a designer,
|
There are different ways to help us, regarding if you are a designer,
|
||||||
a developer or just an user.
|
a developer or an user.
|
||||||
|
|
||||||
As a developer
|
As a developer
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
The best way to contribute code is to write it and to make a pull request on
|
If you want to contribute code, you can write it and then issue a pull request on
|
||||||
github. Please, think about updating and running the tests before asking for
|
github. Please, think about updating and running the tests before asking for
|
||||||
a pull request as it will help us to maintain the code clean and running.
|
a pull request as it will help us to maintain the code clean and running.
|
||||||
|
|
||||||
To do so::
|
To do so::
|
||||||
|
|
||||||
$ workon budget
|
$ make tests
|
||||||
(budget) $ python tests.py
|
|
||||||
|
|
||||||
before pushing anything to master :)
|
|
||||||
|
|
||||||
As a designer / Front-end developer
|
As a designer / Front-end developer
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
@ -95,9 +86,12 @@ know how to implement them, feel free to fork and make a pull request.
|
||||||
End-user
|
End-user
|
||||||
--------
|
--------
|
||||||
|
|
||||||
You just wanted to have a look at the application and found a bug? Please tell
|
You are using the application and found a bug? You have some ideas about how to
|
||||||
us and go fill a new issue:
|
improve the project? Please tell us [by filling a new issue](https://github.com/spiral-project/ihatemoney/issues).
|
||||||
https://github.com/spiral-project/ihatemoney/issues
|
Or, if you prefer, you can send me an email to `alexis@notmyidea.org` and I will
|
||||||
|
update the issue tracker with your feedback.
|
||||||
|
|
||||||
|
Thanks again!
|
||||||
|
|
||||||
How to release?
|
How to release?
|
||||||
===============
|
===============
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
import os.path
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from flask import Flask, g, request, session
|
from flask import Flask, g, request, session
|
||||||
|
@ -11,6 +12,7 @@ from api import api
|
||||||
from utils import PrefixedWSGI
|
from utils import PrefixedWSGI
|
||||||
from utils import minimal_round
|
from utils import minimal_round
|
||||||
|
|
||||||
|
__HERE__ = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@ -65,7 +67,7 @@ if pre_alembic_db():
|
||||||
|
|
||||||
# auto-execute migrations on runtime
|
# auto-execute migrations on runtime
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
upgrade()
|
upgrade(os.path.join(__HERE__, 'migrations'))
|
||||||
|
|
||||||
# mail
|
# mail
|
||||||
mail.init_app(app)
|
mail.init_app(app)
|
||||||
|
|
1
dev-requirements.txt
Normal file
1
dev-requirements.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
zest.releaser
|
13
fabfile.py
vendored
13
fabfile.py
vendored
|
@ -1,13 +0,0 @@
|
||||||
from fabric.api import env, cd, sudo, run
|
|
||||||
|
|
||||||
env.hosts = ['sites.lolnet.lan']
|
|
||||||
|
|
||||||
|
|
||||||
def deploy():
|
|
||||||
with cd('/home//www/ihatemoney.org/code'):
|
|
||||||
sudo('git pull', user="www-data")
|
|
||||||
sudo('supervisorctl restart ihatemoney.org')
|
|
||||||
|
|
||||||
|
|
||||||
def whoami():
|
|
||||||
run('/usr/bin/whoami')
|
|
Loading…
Reference in a new issue