diff options
Diffstat (limited to 'fabfile/helpers.py')
-rw-r--r-- | fabfile/helpers.py | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/fabfile/helpers.py b/fabfile/helpers.py index 9409ca0..ddeb7b8 100644 --- a/fabfile/helpers.py +++ b/fabfile/helpers.py @@ -26,8 +26,12 @@ def update_project(): """ require('src_root', provided_by=['setups.stage', 'setups.production']) require('git_branch', provided_by=['setups.stage', 'setups.production']) - with cd(env.src_root): - run('git pull origin %(git_branch)s' % env) + + if files.exists(env.src_root): + with cd(env.src_root): + run('git pull origin %(git_branch)s' % env) + else: + run('git clone -b %(git_branch)s %(git_url)s %(src_root)s' % env) def link_settings(): @@ -41,32 +45,33 @@ def link_settings(): else: host_settings = join_path(env.config, '%(host)s.py' % env) settings = join_path(env.proj_root, 'local_settings.py') - if files.exists(settings): - run('rm %s' % settings) if files.exists(host_settings): - run('ln -s %s %s' % (host_settings, settings)) + run('ln -sf %s %s' % (host_settings, settings)) else: - print 'No host specific settings file found. Create one at %s' % host_settings + abort('No host specific settings file found. Create one at %s' % host_settings) def collect_static(): """Collects all static files. """ - manage('collectstatic') + manage('collectstatic --noinput') @task def syncdb(): """Runs the syncdb management command. """ - manage('syncdb') + manage('syncdb --noinput') @task def migrate(app_name=None): """Runs the migrations for one or all apps. """ - manage('migrate %s' % app_name) + if app_name is None: + manage('migrate') + else: + manage('migrate %s' % app_name) @task(alias='id') |