parent
8d30c5765b
commit
d634ee6eab
@ -1,21 +0,0 @@ |
||||
# match default value of app_name from cookiecutter.json
|
||||
COOKIE := myflaskapp
|
||||
COOKIE_JAR := {{cookiecutter.app_name}}
|
||||
COOKIE_CRUMBS := $(shell find $(COOKIE_JAR))
|
||||
|
||||
.PHONY: all |
||||
all: test |
||||
|
||||
.PHONY: test |
||||
test: $(COOKIE) |
||||
cd $(COOKIE); pip install -r requirements/dev.txt
|
||||
cd $(COOKIE); coverage run --source $(COOKIE) manage.py test
|
||||
cd $(COOKIE); coverage report -m
|
||||
cd $(COOKIE); coveralls
|
||||
|
||||
$(COOKIE): Makefile cookiecutter.json $(COOKIE_CRUMBS) |
||||
cookiecutter . --no-input
|
||||
|
||||
.PHONY: clean |
||||
clean: |
||||
rm -r $(COOKIE)
|
@ -0,0 +1,28 @@ |
||||
#!/usr/bin/env python |
||||
# -*- coding: utf-8 -*- |
||||
import os |
||||
import shutil |
||||
|
||||
from invoke import task, run |
||||
|
||||
HERE = os.path.abspath(os.path.dirname(__file__)) |
||||
# Match default value of app_name from cookiecutter.json |
||||
COOKIE = os.path.join(HERE, 'myflaskapp') |
||||
REQUIREMENTS = os.path.join(COOKIE, 'requirements', 'dev.txt') |
||||
|
||||
@task |
||||
def build(): |
||||
run('cookiecutter {0} --no-input'.format(HERE)) |
||||
|
||||
@task |
||||
def clean(): |
||||
if os.path.exists(COOKIE): |
||||
shutil.rmtree(COOKIE) |
||||
print('Removed {0}'.format(COOKIE)) |
||||
else: |
||||
print('App directory does not exist. Skipping.') |
||||
|
||||
@task(pre=[clean, build]) |
||||
def test(): |
||||
run('pip install -r {0}'.format(REQUIREMENTS), echo=True) |
||||
run('python {0} test'.format(os.path.join(COOKIE, 'manage.py')), echo=True) |
Loading…
Reference in new issue