Commits

Mikhail Korobov  committed 1fa4296

fab_deploy.commands is gone, hello fab_deploy.virtualenv

  • Participants
  • Parent commits 5cabc52

Comments (0)

Files changed (8)

File docs/guide.rst

        $ pip install jinja2
        $ pip install -e git+git://github.com/bitprophet/fabric.git#egg=Fabric-dev
 
+   .. note::
+
+       django-fab-deploy doesn't work with Fabric 0.9.x, Fabric should be installed
+       from github repository.
+
 2. Create :file:`fabfile.py` at project root. It should provide one or more
    function putting server details into Fabric environment. Otherwise it's just
-   a standart Fabric's fabfile: project-specific scripts can also be put here.
-   Example::
+   a standart Fabric's fabfile (e.g. project-specific scripts can also be put
+   here). Example::
 
         # my_project/fabfile.py
         from fabric.api import *

File fab_deploy/__init__.py

-from fabric.api import *
-
 from fab_deploy.deploy import *
-from fab_deploy.commands import touch, pip, delete_pyc, pip_install, pip_update
+from fab_deploy.virtualenv import pip, pip_install, pip_update
 from fab_deploy.django_commands import migrate, manage, syncdb, compress, test, coverage
+from fab_deploy.utils import run_as, update_env, inside_project, inside_virtualenv, delete_pyc
+from fab_deploy.system import create_linux_account, ssh_add_key
 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
-from fab_deploy.system import create_linux_account
 from fab_deploy.mysql import mysql_execute, mysql_install, mysql_create_db, mysqldump
+from fab_deploy.apache import touch

File fab_deploy/commands.py

-from fabric.api import run, env
-from fab_deploy.apache import touch
-from fab_deploy.utils import run_as, inside_project
-
-@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))
-    touch()
-
-@inside_project
-def pip_update(what='active', options='', restart=True):
-    """ Updates pip requirements listed in reqs/<file>.txt file. """
-    run('pip install %s -U -r reqs/%s.txt' % (options, what))
-    if restart:
-        touch()
-
-@inside_project
-def delete_pyc():
-    """ Deletes *.pyc files from project source dir """
-    run("find . -name '*.pyc' -delete")
-

File fab_deploy/deploy.py

 from fabric.api import env, run, local, settings, cd
 from fabric.contrib.files import upload_template
 
-from fab_deploy.utils import upload_config_template
-from fab_deploy.commands import touch, pip_install, pip_update, delete_pyc
+from fab_deploy.utils import upload_config_template, delete_pyc
+from fab_deploy.virtualenv import pip_install
 from fab_deploy.django_commands import compress, migrate, syncdb, test
 from fab_deploy.system import prepare_server
 from fab_deploy.apache import apache_setup, apache_install, touch
 from fab_deploy.nginx import nginx_setup, nginx_install
+from fab_deploy.virtualenv import virtualenv_create
 
 def full_deploy():
     prepare_server()
     update_django_config()
 
 
-def virtualenv_create():
-    run('mkdir -p envs')
-    run('mkdir -p src')
-    with cd('envs'):
-        run('virtualenv --no-site-packages %s' % env.conf['INSTANCE_NAME'])
-
 def make_clone():
     with cd('src'):
         with settings(warn_only=True):
 def make_hgrc():
     upload_config_template('hgrc', env.conf['SRC_DIR'] + '/.hg/hgrc')
 
-
-
 def update_django_config(restart=True):
     upload_template('config.server.py', '%s/config.py' % env.conf['SRC_DIR'], env.conf, True)
-    if not only_upload:
+    if restart:
         touch()
 
 def up(branch=None):
     compress()
     touch()
 
-
-
 def setup_web_server():
     apache_install()
     nginx_install()

File fab_deploy/django_commands.py

 #coding: utf-8
 from __future__ import with_statement
-from fabric.api import run, settings
+from fabric.api import run, settings, env
 from fab_deploy.mysql import mysqldump
 from fab_deploy.utils import inside_project
 

File fab_deploy/mysql.py

 
 @run_as('root')
 def mysql_install():
-    if mysql_is_installed():
+    if _mysql_is_installed():
         puts('Mysql is already installed.')
         return
 
 
     aptitude_install('mysql-server')
 
-def mysql_is_installed():
+def _mysql_is_installed():
     with settings(warn_only=True):
         output = run('mysql --version')
     return output.succeeded

File fab_deploy/utils.py

         to = base_dir + name
     upload_template('./config_templates/' + name, to, env.conf, True)
 
+@inside_project
+def delete_pyc():
+    """ Deletes *.pyc files from project source dir """
+    run("find . -name '*.pyc' -delete")
+
 def update_env():
     HOME_DIR = '/home/%s' % env.user
 

File fab_deploy/virtualenv.py

+from fabric.api import run, env, cd, env, prefix
+from fab_deploy.apache import touch
+from fab_deploy.utils import run_as, inside_project
+
+@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))
+    touch()
+
+@inside_project
+def pip_update(what='active', options='', restart=True):
+    """ Updates pip requirements listed in reqs/<file>.txt file. """
+    run('pip install %s -U -r reqs/%s.txt' % (options, what))
+    if restart:
+        touch()
+
+def virtualenv_create():
+    run('mkdir -p envs')
+    run('mkdir -p src')
+    with cd('envs'):
+        run('virtualenv --no-site-packages %s' % env.conf['INSTANCE_NAME'])