2015-03-10 01:54:05 +03:00
|
|
|
"""CLI Commands."""
|
2015-01-11 16:03:45 +03:00
|
|
|
|
|
|
|
import os
|
|
|
|
from setup import version
|
|
|
|
from manager import Manager
|
|
|
|
|
|
|
|
|
|
|
|
manager = Manager()
|
|
|
|
|
|
|
|
|
|
|
|
@manager.command
|
|
|
|
def publish(with_tag=True):
|
2015-03-10 01:54:05 +03:00
|
|
|
"""Publish current version to PyPi."""
|
2015-01-11 16:03:45 +03:00
|
|
|
os.system('python setup.py sdist upload')
|
|
|
|
if with_tag:
|
|
|
|
tag()
|
|
|
|
|
|
|
|
|
|
|
|
@manager.command
|
|
|
|
def tag():
|
2015-03-10 01:54:05 +03:00
|
|
|
"""Make tag from current version."""
|
2015-01-11 16:03:45 +03:00
|
|
|
os.system('git tag -a {0} -m \'version {0}\''.format(version))
|
|
|
|
os.system('git push --tags')
|
|
|
|
|
|
|
|
|
2015-03-10 01:54:05 +03:00
|
|
|
@manager.command
|
|
|
|
def check():
|
|
|
|
"""Check `objects` library and examples with code analyzers."""
|
|
|
|
os.system('pylint objects/')
|
|
|
|
os.system('flake8 objects/')
|
|
|
|
os.system('pep257 objects/')
|
|
|
|
|
|
|
|
os.system('pylint examples/')
|
|
|
|
os.system('flake8 examples/')
|
|
|
|
os.system('pep257 examples/')
|
|
|
|
|
2015-03-10 17:03:54 +03:00
|
|
|
|
|
|
|
@manager.command
|
|
|
|
def test():
|
|
|
|
"""Run unittests."""
|
|
|
|
os.system('find ./objects -name "*.pyc" -exec rm -rf {} \\;')
|
|
|
|
os.system('find ./tests -name "*.pyc" -exec rm -rf {} \\;')
|
|
|
|
|
|
|
|
os.system('find ./objects -name "*.pyo" -exec rm -rf {} \\;')
|
|
|
|
os.system('find ./tests -name "*.pyo" -exec rm -rf {} \\;')
|
|
|
|
|
|
|
|
os.system('coverage run --rcfile=./.coveragerc `which unit2` discover')
|
|
|
|
os.system('coverage html --rcfile=./.coveragerc')
|
|
|
|
os.system('rm -f .coverage')
|
|
|
|
|
|
|
|
|
2015-01-11 16:03:45 +03:00
|
|
|
if __name__ == '__main__':
|
|
|
|
manager.main()
|