Commits

Mikhail Korobov  committed 7c99849

'fab pip' command

  • Participants
  • Parent commits d7589de

Comments (0)

Files changed (2)

File fab_deploy/__init__.py

 from fabric.api import *
 
 from fab_deploy.deploy import *
-from fab_deploy.commands import touch, mysqldump, delete_pyc, pip_install, pip_update, restart_apache
+from fab_deploy.commands import touch, pip, mysqldump, delete_pyc, pip_install, pip_update, restart_apache
 from fab_deploy.django_commands import migrate, manage, syncdb, compress, test, coverage
 from fab_deploy.crontab import crontab_set, crontab_add, crontab_show, crontab_remove, crontab_update
 from fab_deploy.utils import run_as, update_env, inside_project, inside_virtualenv

File fab_deploy/commands.py

 from fabric.api import run, env
 from fab_deploy.utils import run_as, inside_project
 
-@run_as('root')
-def restart_apache():
-    run('/etc/init.d/apache2 restart')
-
 @inside_project
 def touch():
     """ Reloads source code by touching the wsgi file """
     run('touch hosting/generated/django.wsgi')
 
 @inside_project
+def pip(commands=''):
+    run('pip '+ commands)
+
+@inside_project
 def pip_install(what='active', options=''):
     """ Installs pip requirements listed in reqs/<file>.txt file. """
     run('pip install %s -r reqs/%s.txt' % (options, what))
 def delete_pyc():
     """ Deletes *.pyc files from project source dir """
     run("find . -name '*.pyc' -delete")
+
+@run_as('root')
+def restart_apache():
+    run('/etc/init.d/apache2 restart')
+