Merge branch 'joshfriend-travis-build'

master
Steven Loria 10 years ago
commit 5760a62a56
  1. 9
      .travis.yml
  2. 5
      README.rst
  3. 28
      tasks.py
  4. 6
      {{cookiecutter.app_name}}/manage.py
  5. 2
      {{cookiecutter.app_name}}/requirements/dev.txt
  6. 10
      {{cookiecutter.app_name}}/requirements/prod.txt

@ -0,0 +1,9 @@
language: python
python:
- 2.7
- 3.3
- 3.4
install:
- pip install invoke==0.9.0
script:
- invoke test

@ -5,6 +5,11 @@ A Flask template for cookiecutter_.
.. _cookiecutter: https://github.com/audreyr/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 Use it now
---------- ----------
:: ::

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

@ -16,8 +16,10 @@ if os.environ.get("{{cookiecutter.app_name | upper}}_ENV") == 'prod':
else: else:
app = create_app(DevConfig) app = create_app(DevConfig)
HERE = os.path.abspath(os.path.dirname(__file__))
TEST_PATH = os.path.join(HERE, 'tests')
manager = Manager(app) manager = Manager(app)
TEST_CMD = "py.test tests"
def _make_context(): def _make_context():
"""Return context dict for a shell session so you can access """Return context dict for a shell session so you can access
@ -29,7 +31,7 @@ def _make_context():
def test(): def test():
"""Run the tests.""" """Run the tests."""
import pytest import pytest
exit_code = pytest.main(['tests', '--verbose']) exit_code = pytest.main([TEST_PATH, '--verbose'])
return exit_code return exit_code
manager.add_command('server', Server()) manager.add_command('server', Server())

@ -2,7 +2,7 @@
-r prod.txt -r prod.txt
# Testing # Testing
pytest pytest>=2.6.3
webtest webtest
factory-boy==2.4.1 factory-boy==2.4.1

@ -9,7 +9,7 @@ itsdangerous==0.24
# Database # Database
Flask-SQLAlchemy==2.0 Flask-SQLAlchemy==2.0
SQLAlchemy==0.9.7 SQLAlchemy==0.9.8
# Migrations # Migrations
Flask-Migrate==1.2.0 Flask-Migrate==1.2.0
@ -19,16 +19,16 @@ Flask-WTF==0.10.2
WTForms==2.0.1 WTForms==2.0.1
# Deployment # Deployment
gunicorn>=17.5 gunicorn>=19.1.1
# Assets # Assets
Flask-Assets==0.10 Flask-Assets==0.10
cssmin>=0.1.4 cssmin>=0.2.0
jsmin>=2.0.4 jsmin>=2.0.11
# Auth # Auth
Flask-Login==0.2.11 Flask-Login==0.2.11
Flask-Bcrypt==0.6.0 Flask-Bcrypt==0.6.0
# Caching # Caching
Flask-Cache>=0.12 Flask-Cache>=0.13.1

Loading…
Cancel
Save