Last active
October 10, 2015 15:58
-
-
Save yveson33/3715457 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from os import path | |
from fabric.api import local, settings, abort, run, cd, env, sudo | |
from fabric.contrib.project import rsync_project | |
def prepare_deploy(): | |
local("rm -rf app/cache/*") | |
local("rm -rf app/logs/*") | |
def staging(): | |
env.user = 'user' | |
env.home = "/path" | |
env.hosts = ['domain'] | |
env.exclude = ['fabfile.py', 'fabfile.pyc'] | |
env.environment = 'dev' | |
def production(): | |
env.user = 'user' | |
env.home = "/path" | |
env.hosts = ['domain'] | |
env.exclude = ['app/cache/*', 'app/logs/*', 'web/media/*', 'Makefile', 'fabfile.py', 'fabfile.pyc'] | |
env.environment = 'prod' | |
def migrate(): | |
with cd(env.home): | |
run("app/console doctrine:migrations:migrate") | |
def drop_db(): | |
""" WARNING Don't used in production """ | |
#with cd(env.home): | |
#run("app/console doctrine:database:drop --force") | |
def create_db(): | |
with cd(env.home): | |
run("app/console doctrine:database:create") | |
def lock(): | |
with cd(env.home): | |
run("app/console lexik:maintenance:lock") | |
def unlock(): | |
with cd(env.home): | |
run("app/console lexik:maintenance:unlock") | |
def rsync(): | |
rsync_project( | |
env.home, os.getcwd() + "/", exclude=env.exclude, delete=True) | |
def fixtures(): | |
with cd(env.home): | |
run("app/console doctrine:fixtures:load") | |
def assets_install(): | |
with cd(env.home): | |
run("app/console cache:clear --env=%s" % env.environment) | |
run("app/console assets:install web --symlink") | |
run("rm -rf app/cache/*") | |
run("rm -rf app/log/*") | |
def deploy(): | |
prepare_deploy() | |
rsync() | |
assets_install() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment