From: Lucian Ursu Date: Thu, 28 Feb 2013 19:27:32 +0000 (+0200) Subject: Added another task that handles the first deploy. X-Git-Tag: release-20150131~498^2~2^2~2 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=aaf8357ef31c7453dd3527abeb3a5189aec0a164;p=oweals%2Fkarmaworld.git Added another task that handles the first deploy. --- diff --git a/fabfile.py b/fabfile.py index ada9fed..65a5e9d 100755 --- a/fabfile.py +++ b/fabfile.py @@ -3,7 +3,7 @@ import os from contextlib import contextmanager as _contextmanager -from fabric.api import cd, env, prefix, run, task, local +from fabric.api import cd, env, prefix, run, task, local, settings ########## GLOBALS @@ -239,6 +239,32 @@ def restart_gunicorn(): supervisorctl('restart', 'gunicorn') +@task +def first_deploy(): + """ + Sets up and deploys the project for the first time. + """ + # If we're on the local machine, there's no point in cloning + # the project, because it's already been cloned. Otherwise + # the user couldn't run this file + if env.run == run: + # We're doing this to filter out the hosts that have + # already been setup and deployed to + with settings(warn_only=True): + if env.run('test -d %s' % env.project).failed: + return + clone() + + make_virtualenv() + update_reqs() + syncdb() + manage_static() + + # We don't start supervisor on development machines + if env.run == run: + start_supervisord() + + @task def deploy(): """