Ejemplo n.º 1
0
def update_dev(repository='upstream'):
    """Update development packages

    Depending on PROJECT_TYPE it runs pip updates dev3rdparty or edge
    If PROJECT_DeV it also git checkes master and pulls master from upstream

    Example: fab update_dev
    """
    _default('local')
    if not os.path.exists(env.workondir):
        if not confirm("No virtualenv provided. Should I install?"):
            return
        install_dev()
        return
    local("git status")
    if confirm("Should I checkout to and pull from master?"):
        local("git checkout master && git pull %s master" % repository)

    if sett.PROJECT_TYPE == sett.PROJECT_DEV:
        # update APPS
        _ve_local("pip install -r requirements/dev3rdparty.pip")
        for app in sett.APPS:
            with lcd(os.path.join(env.workondir, env.virtualenv, 'src', app)):
                print _cyan('Updating %s' % app)
                local("git status")
                if confirm("Should I checkout to and pull from master"):
                    local("git status")
                    local("git checkout master && git pull %s master" % repository)
    if sett.PROJECT_TYPE == sett.PROJECT_EDGE:
        # update APPS from master branch
        _ve_local("pip install -r requirements/edge.pip --upgrade")
Ejemplo n.º 2
0
def update_dev(repository='upstream'):
    """Update development packages

    Depending on PROJECT_TYPE it runs pip updates dev3rdparty or edge
    If PROJECT_DeV it also git checkes master and pulls master from upstream

    Example: fab update_dev
    """
    _default('local')
    if not os.path.exists(env.workondir):
        if not confirm("No virtualenv provided. Should I install?"):
            return
        install_dev()
        return
    local("git status")
    if confirm("Should I checkout to and pull from master?"):
        local("git checkout master && git pull %s master" % repository)

    if sett.PROJECT_TYPE == sett.PROJECT_DEV:
        # update APPS
        _ve_local("pip install -r requirements/dev3rdparty.pip")
        for app in sett.APPS:
            with lcd(os.path.join(env.workondir, env.virtualenv, 'src', app)):
                print _cyan('Updating %s' % app)
                local("git status")
                if confirm("Should I checkout to and pull from master"):
                    local("git status")
                    local("git checkout master && git pull %s master" % repository)
    if sett.PROJECT_TYPE == sett.PROJECT_EDGE:
        # update APPS from master branch
        _ve_local("pip install -r requirements/edge.pip --upgrade")
Ejemplo n.º 3
0
def _push_heroku():
    """Push the latest code to Heroku."""
    print(_cyan('Maintenance mode on.'))
    local('heroku maintenance:on')
    print(_yellow('Pushing to Heroku...', bold=True))
    local('git push heroku master')
    local('heroku maintenance:off')
    print(_cyan('Maintenance mode off.'))
Ejemplo n.º 4
0
def status(*args):
    _default('local')
    apps = args or sett.APPS
    local('git status')
    if sett.PROJECT_TYPE == sett.PROJECT_DEV:
        for app in apps:
            print _cyan("\n%s" % app)
            with lcd(os.path.join(
                    env.workondir, env.virtualenv, 'src', app)):
                local("git status")
Ejemplo n.º 5
0
def status(*args):
    _default('local')
    apps = args or sett.APPS
    local('git status')
    if sett.PROJECT_TYPE == sett.PROJECT_DEV:
        for app in apps:
            print _cyan("\n%s" % app)
            with lcd(os.path.join(
                    env.workondir, env.virtualenv, 'src', app)):
                local("git status")
Ejemplo n.º 6
0
def sendWarning(message, parser=False):
    logging.basicConfig(
        stream=sys.stdout,
        level=logging.DEBUG,
        format=_cyan('%(asctime)-15s %(levelname)s >>>', bold=True) +
        '  %(message)s')
    logging.warning(_yellow(message))
    if parser:
        parser.print_help()
Ejemplo n.º 7
0
def commit(*args):
    """Commit changes from working project, (and all other apps if PROJECT_DEV)
    """
    _default('local')
    apps = args or sett.APPS
    with settings(warn_only=True):
        local("git status")
        result = local("git add -p && git commit -v")
        if (result.failed
                and sett.PROJECT_TYPE == sett.PROJECT_DEV
                and not confirm('Proceed further?')):
            return
        if sett.PROJECT_TYPE == sett.PROJECT_DEV:
            for app in apps:
                print _cyan("\n******* Commit (%s) *******" % app)
                with lcd(os.path.join(
                        env.workondir, env.virtualenv, 'src', app)):
                    local("git status")
                    result = local("git add -p && git commit -v ")
                if (result.failed and sett.APPS[-1] != app
                        and not confirm('Proceed further?')):
                    return
Ejemplo n.º 8
0
def commit(*args):
    """Commit changes from working project, (and all other apps if PROJECT_DEV)
    """
    _default('local')
    apps = args or sett.APPS
    with settings(warn_only=True):
        local("git status")
        result = local("git add -p && git commit -v")
        if (result.failed
                and sett.PROJECT_TYPE == sett.PROJECT_DEV
                and not confirm('Proceed further?')):
            return
        if sett.PROJECT_TYPE == sett.PROJECT_DEV:
            for app in apps:
                print _cyan("\n******* Commit (%s) *******" % app)
                with lcd(os.path.join(
                        env.workondir, env.virtualenv, 'src', app)):
                    local("git status")
                    result = local("git add -p && git commit -v ")
                if (result.failed and sett.APPS[-1] != app
                        and not confirm('Proceed further?')):
                    return
Ejemplo n.º 9
0
def push(repo='origin', branch=None):
    """Push all commits to ``repo`` using branch ``branch``
    """
    _default('local')
    with lcd(env.directory):
        test()
        if not branch:
            # discover current branch
            branch = 'master'
        local('git status')
        if confirm("Should I push to repository %s banch %s?" %
                (repo, branch)):
            local('git push %s %s' % (repo, branch))
        if sett.PROJECT_TYPE == sett.PROJECT_DEV:
            for app in sett.APPS:
                print _cyan("\nPushing to %s" % app)
                with lcd(os.path.join(
                        env.workondir, env.virtualenv, 'src', app)):
                    local("git status")
                    if confirm(("Should I checkout and push to "
                        "repository %s banch %s?") %
                            (repo, branch)):
                        local("git checkout %s" % branch)
                        local('git push %s %s' % (repo, branch))
Ejemplo n.º 10
0
def push(repo='origin', branch=None):
    """Push all commits to ``repo`` using branch ``branch``
    """
    _default('local')
    with lcd(env.directory):
        test()
        if not branch:
            # discover current branch
            branch = 'master'
        local('git status')
        if confirm("Should I push to repository %s banch %s?" %
                (repo, branch)):
            local('git push %s %s' % (repo, branch))
        if sett.PROJECT_TYPE == sett.PROJECT_DEV:
            for app in sett.APPS:
                print _cyan("\nPushing to %s" % app)
                with lcd(os.path.join(
                        env.workondir, env.virtualenv, 'src', app)):
                    local("git status")
                    if confirm(("Should I checkout and push to "
                        "repository %s banch %s?") %
                            (repo, branch)):
                        local("git checkout %s" % branch)
                        local('git push %s %s' % (repo, branch))
Ejemplo n.º 11
0
 def info(self):
     print(_cyan(self.message))
Ejemplo n.º 12
0
 def info(self):
     print(_cyan(self.message))