mirror of
https://github.com/nikdoof/pacmanager.git
synced 2025-12-11 14:42:16 +00:00
Add some more fabric commands
This commit is contained in:
21
fabfile.py
vendored
21
fabfile.py
vendored
@@ -32,22 +32,23 @@ def chdir(path):
|
|||||||
if env.local:
|
if env.local:
|
||||||
with lcd(path):
|
with lcd(path):
|
||||||
yield
|
yield
|
||||||
with cd(path):
|
else:
|
||||||
yield
|
with cd(path):
|
||||||
|
yield
|
||||||
|
|
||||||
@_contextmanager
|
@_contextmanager
|
||||||
def virtualenv():
|
def virtualenv():
|
||||||
with chdir(env.path):
|
with chdir(env.path):
|
||||||
with prefix('. %s' % os.path.join(env.path, 'env/bin/activate')):
|
with prefix('. %s' % os.path.join(env.path, 'env/bin/activate')):
|
||||||
yield
|
yield
|
||||||
|
|
||||||
def manage(args):
|
def manage(args):
|
||||||
"""Run and Django manage.py command"""
|
"""Run and Django manage.py command"""
|
||||||
with virtualenv():
|
with virtualenv():
|
||||||
runcmd('%s %s' % (env.managepath, args))
|
runcmd('%s %s' % (env.managepath, args))
|
||||||
|
|
||||||
## Tasks
|
## Tasks
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def virtualenv_setup():
|
def virtualenv_setup():
|
||||||
if not os.path.exists('env'):
|
if not os.path.exists('env'):
|
||||||
@@ -62,10 +63,14 @@ def runserver(port=3333):
|
|||||||
ip = runcmd("""ip addr list eth0 |grep "inet " |cut -d' ' -f6|cut -d/ -f1""", capture=True)
|
ip = runcmd("""ip addr list eth0 |grep "inet " |cut -d' ' -f6|cut -d/ -f1""", capture=True)
|
||||||
manage('runserver %s:%s' % (ip, port))
|
manage('runserver %s:%s' % (ip, port))
|
||||||
|
|
||||||
|
@task
|
||||||
|
def collectstatic():
|
||||||
|
manage('collectstatic --link --noinput')
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def syncdb():
|
def syncdb():
|
||||||
manage('syncdb --migrate --noinput')
|
manage('syncdb --migrate --noinput')
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def test():
|
def test():
|
||||||
manage('test --noinput --failfast')
|
manage('test --noinput --failfast')
|
||||||
Reference in New Issue
Block a user