예제 #1
0
파일: utils.py 프로젝트: adamzev/burlap
def get_cwd(local=False):

    from fabric.api import local as local_run

    with hide('running', 'stdout'):
        if local:
            return local_run('pwd', capture=True)
        return run('pwd')
예제 #2
0
파일: utils.py 프로젝트: chrisspen/burlap
def get_cwd(local=False):

    from fabric.api import local as local_run

    with hide('running', 'stdout'):
        if local:
            return local_run('pwd', capture=True)
        return run('pwd')
예제 #3
0
    $ fab local deploy
    $ fab prod deploy

TODO: Give time for this code to mature, then submit it to fabric/contrib.

Copyright (C) 2011 by Denis Ryzhkov <*****@*****.**>
MIT License, see http://opensource.org/licenses/MIT
'''

__all__ = 'run sudo cd'.split()

from fabric.api import env
env.is_local = False # default

#### run

from fabric.api import run as remote_run, local as local_run
run = lambda command, capture=False: local_run(command, capture=capture) if env.is_local else remote_run(command)

#### sudo

from fabric.api import sudo as remote_sudo
local_sudo = lambda command, capture=False: local_run('sudo ' + command, capture=capture)
sudo = lambda command, capture=False: local_sudo(command, capture=capture) if env.is_local else remote_sudo(command)

#### cd

from fabric.api import cd as remote_cd, lcd as local_cd
from contextlib import contextmanager
cd = lambda path: (local_cd if env.is_local else remote_cd)(path)