diff options
Diffstat (limited to 'tasks.py')
-rw-r--r-- | tasks.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tasks.py b/tasks.py new file mode 100644 index 0000000..e2e084b --- /dev/null +++ b/tasks.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +import os +import sys + +from invoke import task, run + +docs_dir = 'docs' +build_dir = os.path.join(docs_dir, '_build') + + +@task +def test(): + run('python setup.py test', pty=True) + + +@task +def clean(): + run("rm -rf build") + run("rm -rf dist") + run("rm -rf anteater.egg-info") + clean_docs() + print("Cleaned up.") + + +@task +def clean_docs(): + run("rm -rf %s" % build_dir) + + +@task +def browse_docs(): + run("open %s" % os.path.join(build_dir, 'index.html')) + + +@task +def build_docs(clean=False, browse=False): + if clean: + clean_docs() + run("sphinx-build %s %s" % (docs_dir, build_dir), pty=True) + if browse: + browse_docs() + + +@task +def readme(browse=False): + run('rst2html.py README.rst > README.html') + + +@task +def publish(test=False): + """Publish to the cheeseshop.""" + if test: + run('python setup.py register -r test sdist upload -r test') + else: + run("python setup.py register sdist upload") |