Files
old-krovovi-kalkulator/tasks.py
2017-11-21 17:11:29 +01:00

55 lines
1.4 KiB
Python

from invoke import run, task
@task
def install(ctx):
run('pip install -r requirements.txt')
run('pip install -r requirements.test.txt')
run('bundle')
run('npm i')
@task
def test(ctx):
run('nosetests')
test_js_ci(ctx)
@task
def test_ci(ctx):
run('nosetests --nologcapture --with-xunit --xunit-file $CIRCLE_TEST_REPORTS/nosetests.xml')
test_js_ci(ctx)
def test_js_ci(ctx):
run('./node_modules/.bin/karma start spec/javascripts/karma.config.js')
@task
def test_js(ctx):
run('./node_modules/.bin/karma start spec/javascripts/karma.config.js')
@task
def update_version(ctx):
run('echo "import os\n\n\ndef version():\n if os.getenv(\'VERSION\'):\n return os.getenv(\'VERSION\')\n return \'$(git describe --tags)\'" > helix/constants/version.py')
@task
def serve(ctx):
run('PYTHONPATH=. SP_DOCGEN_API_KEY=DC97-20AF-567E python helix/main.py')
@task
def update_heroku_version(ctx, environment):
run('curl -n -X PATCH https://api.heroku.com/apps/sp-helix-%s/config-vars -d "{\\"VERSION\\": \\"$(git describe --tags)\\"}" -H "Content-Type: application/json" -H "Accept: application/vnd.heroku+json; version=3"' % environment)
@task
def db_migrate(ctx):
run('PYTHONPATH=.:$PYTHONPATH alembic upgrade head')
@task
def serve_debug(ctx):
run('PYTHONPATH=. FLASK_DEBUG=1 SP_DOCGEN_API_KEY=DC97-20AF-567E python helix/main.py')