Beispiel #1
0
def start_server():
    if is_running(get_pid()):
        yellow("Server is already running")
        return

    try:
        open(config.PIDFILE, 'w')
    except IOError:
        red("PID file not writeable (%s) " % config.PIDFILE)
        return

    flags = '--daemon --pid %s' % config.PIDFILE

    green("Server started. Port: %s" % config.PORT)

    config_path = config.get_path()
    if config_path:
        green("Using config: %s" % config_path)
    else:
        yellow("Using default configuration")

    prefix = ''
    if in_virtualenv():
        prefix = get_prefix() + "/bin/"

    Popen("%sgunicorn 'realms:create_app()' -b 0.0.0.0:%s -k gevent %s" %
          (prefix, config.PORT, flags), shell=True, executable='/bin/bash')
Beispiel #2
0
def setup_upstart(**kwargs):
    """ Start upstart conf creation wizard
    """
    from realms.lib.util import upstart_script

    if in_virtualenv():
        app_dir = get_prefix()
        path = '/'.join(sys.executable.split('/')[:-1])
    else:
        # Assumed root install, not sure if this matters?
        app_dir = '/'
        path = None

    kwargs.update(dict(app_dir=app_dir, path=path))

    conf_file = '/etc/init/realms-wiki.conf'
    script = upstart_script(**kwargs)

    try:
        with open(conf_file, 'w') as f:
            f.write(script)
        green('Wrote file to %s' % conf_file)
    except IOError:
        with open('/tmp/realms-wiki.conf', 'w') as f:
            f.write(script)
        yellow("Wrote file to /tmp/realms-wiki.conf, to install type:")
        yellow("sudo mv /tmp/realms-wiki.conf /etc/init/realms-wiki.conf")

    click.echo()
    click.echo("Upstart usage:")
    green("sudo start realms-wiki")
    green("sudo stop realms-wiki")
    green("sudo restart realms-wiki")
    green("sudo status realms-wiki")
Beispiel #3
0
def start_server():
    if is_running(get_pid()):
        yellow("Server is already running")
        return

    try:
        open(config.PIDFILE, 'w')
    except IOError:
        red("PID file not writeable (%s) " % config.PIDFILE)
        return

    flags = '--daemon --pid %s' % config.PIDFILE

    green("Server started. Port: %s" % config.PORT)

    config_path = config.get_path()
    if config_path:
        green("Using config: %s" % config_path)
    else:
        yellow("Using default configuration")

    prefix = ''
    if in_virtualenv():
        prefix = get_prefix() + "/bin/"

    Popen("%sgunicorn 'realms:create_app()' -b 0.0.0.0:%s -k gevent %s" %
          (prefix, config.PORT, flags),
          shell=True,
          executable='/bin/bash')
Beispiel #4
0
def setup_upstart(**kwargs):
    """ Start upstart conf creation wizard
    """
    from realms.lib.util import upstart_script

    if in_virtualenv():
        app_dir = get_prefix()
        path = '/'.join(sys.executable.split('/')[:-1])
    else:
        # Assumed root install, not sure if this matters?
        app_dir = '/'
        path = None

    kwargs.update(dict(app_dir=app_dir, path=path))

    conf_file = '/etc/init/realms-wiki.conf'
    script = upstart_script(**kwargs)

    try:
        with open(conf_file, 'w') as f:
            f.write(script)
        green('Wrote file to %s' % conf_file)
    except IOError:
        with open('/tmp/realms-wiki.conf', 'w') as f:
            f.write(script)
        yellow("Wrote file to /tmp/realms-wiki.conf, to install type:")
        yellow("sudo mv /tmp/realms-wiki.conf /etc/init/realms-wiki.conf")

    click.echo()
    click.echo("Upstart usage:")
    green("sudo start realms-wiki")
    green("sudo stop realms-wiki")
    green("sudo restart realms-wiki")
    green("sudo status realms-wiki")
Beispiel #5
0
def test():
    """ 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'])
Beispiel #6
0
def test():
    """ 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'])