Пример #1
0
    """ Run tests
    """
    for mod in [('flask.ext.testing', 'Flask-Testing'), ('nose', 'nose'), ('blinker', 'blinker')]:
        if not module_exists(mod[0]):
            pip.main(['install', mod[1]])

    nosetests = get_prefix() + "/bin/nosetests" if in_virtualenv() else "nosetests"

    call([nosetests, 'realms'])


@cli.command()
def version():
    """ Output version
    """
    green(__version__)


@cli.command(add_help_option=False)
def deploy():
    """ Deploy to PyPI and docker hub
    """
    call("python setup.py sdist upload", shell=True)
    call("sudo docker build --no-cache -t realms/realms-wiki %s/docker" % app.config['APP_PATH'], shell=True)
    id_ = json.loads(Popen("sudo docker inspect realms/realms-wiki".split(), stdout=subprocess.PIPE).communicate()[0])[0]['Id']
    call("sudo docker tag %s realms/realms-wiki:%s" % (id_, __version__), shell=True)
    call("sudo docker push realms/realms-wiki", shell=True)

if __name__ == '__main__':
    cli()
Пример #2
0
    ) else "nosetests"

    call([nosetests, 'realms'])


@cli.command()
def version():
    """ Output version
    """
    green(__version__)


@cli.command(add_help_option=False)
def deploy():
    """ Deploy to PyPI and docker hub
    """
    call("python setup.py sdist upload", shell=True)
    call("sudo docker build --no-cache -t realms/realms-wiki %s/docker" %
         app.config['APP_PATH'],
         shell=True)
    id_ = json.loads(
        Popen("sudo docker inspect realms/realms-wiki".split(),
              stdout=subprocess.PIPE).communicate()[0])[0]['Id']
    call("sudo docker tag %s realms/realms-wiki:%s" % (id_, __version__),
         shell=True)
    call("sudo docker push realms/realms-wiki", shell=True)


if __name__ == '__main__':
    cli()