From 23bbed7e41b315ce745c3f935ca70888475c8e35 Mon Sep 17 00:00:00 2001 From: Christian Stade-Schuldt Date: Sat, 18 Oct 2014 23:47:28 +0200 Subject: [PATCH 1/7] updated requirements to latest version --- {{cookiecutter.app_name}}/requirements/dev.txt | 2 +- {{cookiecutter.app_name}}/requirements/prod.txt | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/{{cookiecutter.app_name}}/requirements/dev.txt b/{{cookiecutter.app_name}}/requirements/dev.txt index d4c113d..8a668fc 100644 --- a/{{cookiecutter.app_name}}/requirements/dev.txt +++ b/{{cookiecutter.app_name}}/requirements/dev.txt @@ -2,7 +2,7 @@ -r prod.txt # Testing -pytest +pytest>=2.6.3 webtest factory-boy==2.4.1 diff --git a/{{cookiecutter.app_name}}/requirements/prod.txt b/{{cookiecutter.app_name}}/requirements/prod.txt index 4682759..ea1ce94 100644 --- a/{{cookiecutter.app_name}}/requirements/prod.txt +++ b/{{cookiecutter.app_name}}/requirements/prod.txt @@ -9,7 +9,7 @@ itsdangerous==0.24 # Database Flask-SQLAlchemy==2.0 -SQLAlchemy==0.9.7 +SQLAlchemy==0.9.8 # Migrations Flask-Migrate==1.2.0 @@ -19,16 +19,16 @@ Flask-WTF==0.10.2 WTForms==2.0.1 # Deployment -gunicorn>=17.5 +gunicorn>=19.1.1 # Assets Flask-Assets==0.10 -cssmin>=0.1.4 -jsmin>=2.0.4 +cssmin>=0.2.0 +jsmin>=2.0.11 # Auth Flask-Login==0.2.11 Flask-Bcrypt==0.6.0 # Caching -Flask-Cache>=0.12 +Flask-Cache>=0.13.1 From ccf91009d6d95922ea79577211b923f67b987d24 Mon Sep 17 00:00:00 2001 From: Josh Friend Date: Sun, 2 Nov 2014 22:05:03 -0500 Subject: [PATCH 2/7] Build cookies on Travis --- .travis.yml | 9 +++++++++ Makefile | 19 +++++++++++++++++++ README.rst | 4 ++++ 3 files changed, 32 insertions(+) create mode 100644 .travis.yml create mode 100644 Makefile diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8a1ccbd --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +language: python +python: + - 2.7 + - 3.3 + - 3.4 +install: + - pip install cookiecutter +script: + - make diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4765409 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +# 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); python manage.py test + +$(COOKIE): Makefile cookiecutter.json $(COOKIE_CRUMBS) + cookiecutter . --no-input + +.PHONY: clean +clean: + rm -r $(COOKIE) diff --git a/README.rst b/README.rst index 7f33508..b5fd9ac 100644 --- a/README.rst +++ b/README.rst @@ -5,6 +5,10 @@ A Flask template for cookiecutter_. .. _cookiecutter: https://github.com/audreyr/cookiecutter +.. image:: https://travis-ci.org/sloria/cookiecutter-flask.svg + :target: https://travis-ci.org/sloria/cookiecutter-flask + :alt: Build Status + Use it now ---------- :: From bcc2b7bd9c9853b142955da9de9c8e493e5542da Mon Sep 17 00:00:00 2001 From: Josh Friend Date: Sun, 2 Nov 2014 22:29:50 -0500 Subject: [PATCH 3/7] run coverage on cookies and report to coveralls.io --- .travis.yml | 4 +++- Makefile | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8a1ccbd..74baa44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,8 @@ python: - 3.3 - 3.4 install: - - pip install cookiecutter + - pip install cookiecutter coveralls script: - make +after_success: + - coveralls diff --git a/Makefile b/Makefile index 4765409..fba34f7 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,8 @@ all: test .PHONY: test test: $(COOKIE) cd $(COOKIE); pip install -r requirements/dev.txt - cd $(COOKIE); python manage.py test + cd $(COOKIE); coverage run --source $(COOKIE) manage.py test + cd $(COOKIE); coverage report -m $(COOKIE): Makefile cookiecutter.json $(COOKIE_CRUMBS) cookiecutter . --no-input From 63a68d3c1b9ab88448d935fd86ed41e16c32ac71 Mon Sep 17 00:00:00 2001 From: Josh Friend Date: Sun, 2 Nov 2014 22:41:33 -0500 Subject: [PATCH 4/7] add coveralls.io badge to README --- README.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.rst b/README.rst index b5fd9ac..40626b0 100644 --- a/README.rst +++ b/README.rst @@ -8,6 +8,11 @@ A Flask template for cookiecutter_. .. image:: https://travis-ci.org/sloria/cookiecutter-flask.svg :target: https://travis-ci.org/sloria/cookiecutter-flask :alt: Build Status +.. image:: https://coveralls.io/repos/sloria/cookiecutter-flask/badge.png + :target: https://coveralls.io/r/sloria/cookiecutter-flask + :alt: Coverage Status + + Use it now ---------- From 8d30c5765bc531b7d798cf3827926a26eb4c38ee Mon Sep 17 00:00:00 2001 From: Josh Friend Date: Sun, 2 Nov 2014 22:58:00 -0500 Subject: [PATCH 5/7] looks like `coveralls` needs to be run from the dir containing .coverage --- .travis.yml | 2 -- Makefile | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 74baa44..0d32a47 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,5 +7,3 @@ install: - pip install cookiecutter coveralls script: - make -after_success: - - coveralls diff --git a/Makefile b/Makefile index fba34f7..7e2d195 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ 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 From d634ee6eabe7b359476c2aa435177ac1e1ab2d62 Mon Sep 17 00:00:00 2001 From: Steven Loria Date: Mon, 1 Dec 2014 00:08:20 -0600 Subject: [PATCH 6/7] Replace Makefile with invoke tasks.py file --- .travis.yml | 4 ++-- Makefile | 21 --------------------- tasks.py | 28 ++++++++++++++++++++++++++++ {{cookiecutter.app_name}}/manage.py | 6 ++++-- 4 files changed, 34 insertions(+), 25 deletions(-) delete mode 100644 Makefile create mode 100644 tasks.py diff --git a/.travis.yml b/.travis.yml index 0d32a47..454acf5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,6 @@ python: - 3.3 - 3.4 install: - - pip install cookiecutter coveralls + - pip install invoke==0.9.0 script: - - make + - invoke test diff --git a/Makefile b/Makefile deleted file mode 100644 index 7e2d195..0000000 --- a/Makefile +++ /dev/null @@ -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) diff --git a/tasks.py b/tasks.py new file mode 100644 index 0000000..0ff1a87 --- /dev/null +++ b/tasks.py @@ -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) diff --git a/{{cookiecutter.app_name}}/manage.py b/{{cookiecutter.app_name}}/manage.py index 1ce37b7..f5cc479 100644 --- a/{{cookiecutter.app_name}}/manage.py +++ b/{{cookiecutter.app_name}}/manage.py @@ -16,8 +16,10 @@ if os.environ.get("{{cookiecutter.app_name | upper}}_ENV") == 'prod': else: app = create_app(DevConfig) +HERE = os.path.abspath(os.path.dirname(__file__)) +TEST_PATH = os.path.join(HERE, 'tests') + manager = Manager(app) -TEST_CMD = "py.test tests" def _make_context(): """Return context dict for a shell session so you can access @@ -29,7 +31,7 @@ def _make_context(): def test(): """Run the tests.""" import pytest - exit_code = pytest.main(['tests', '--verbose']) + exit_code = pytest.main([TEST_PATH, '--verbose']) return exit_code manager.add_command('server', Server()) From 60d01cd13fc6f89eb2cc51b204b6b3c6d7606aa2 Mon Sep 17 00:00:00 2001 From: Steven Loria Date: Mon, 1 Dec 2014 00:09:00 -0600 Subject: [PATCH 7/7] Remove coverage badge --- README.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.rst b/README.rst index 40626b0..4c648f1 100644 --- a/README.rst +++ b/README.rst @@ -8,10 +8,6 @@ A Flask template for cookiecutter_. .. image:: https://travis-ci.org/sloria/cookiecutter-flask.svg :target: https://travis-ci.org/sloria/cookiecutter-flask :alt: Build Status -.. image:: https://coveralls.io/repos/sloria/cookiecutter-flask/badge.png - :target: https://coveralls.io/r/sloria/cookiecutter-flask - :alt: Coverage Status - Use it now