Commits

Markus Zapke-Gründemann committed aba469e

Improved deployment task.

Asks for confirmation before deployment.
Deletes all old files before deploying new.

  • Participants
  • Parent commits d135cc8

Comments (0)

Files changed (1)

-"""fabfile to deploy the static files of django-introduction to your server.
+"""fabfile to deploy the static files of django-introduction on your server.
 """
 from fabric.api import *
-from fabric.contrib import files
+from fabric.contrib import console, files
 from fabric.utils import abort, fastprint
 
 
         remotepath = env.get('remotepath')
     if not remotepath:
         abort(ERRMSG)
-    local('make clean')
-    local('make static')
-    if not files.exists(remotepath):
-        run('mkdir %s' % remotepath)
+    local('make clean static')
+    question = 'Continue and deploy static files '
+    question += 'to %(host_string)s:%(remotepath)s?' % env
+    if not console.confirm(question):
+        abort('Delpoyment cancelled.')
+    if files.exists(remotepath):
+        run('rm -rf %s' % remotepath)
+    run('mkdir %s' % remotepath)
     put('static/*', remotepath)
-    fastprint('Successfully deployed static files to "%s".' % remotepath)
+    msg = 'Successfully deployed static files '
+    msg += 'to %(host_string)s:%(remotepath)s.' % env
+    fastprint(msg)