Luke Plant avatar Luke Plant committed a30ed25

Fixed fabfile for changes in Fabric

Comments (0)

Files changed (1)

 from fabric.contrib import files
 from fabric.contrib import console
 from fabric.decorators import hosts, runs_once
-from fabric.context_managers import cd, settings, hide
+from fabric.context_managers import cd, lcd, settings, hide
 import os
 import os.path
 join = os.path.join
 
 @runs_once
 def ensure_dependencies():
-    hg_branch = local("cd deps/django; hg branch")
-    if hg_branch.strip() != 'default':
-        abort("Django src on incorrect branch")
+    with lcd(parent_dir):
+        hg_branch = local("cd deps/django; hg branch", capture=True)
+        if hg_branch.strip() != 'default':
+            abort("Django src on incorrect branch")
 
 
 def test():
 def rsync_dir(local_dir, dest_dir):
     # clean first
     with settings(warn_only=True):
-        local("find -L %s -name '*.pyc' | xargs rm" % local_dir)
+        local("find -L %s -name '*.pyc' | xargs rm || true" % local_dir, capture=True)
     local("rsync -z -r -L --delete --exclude='_build' --exclude='.hg' --exclude='.git' --exclude='.svn' --delete-excluded %s/ cciw@cciw.co.uk:%s" % (local_dir, dest_dir), capture=False)
 
 
     else:
         run("mkdir %s" % version.src_dir)
 
-    with cd(parent_dir):
+    with lcd(parent_dir):
         # rsync the project.
         rsync_dir(project_dir, version.project_dir)
         # rsync the deps
 
 
 def deploy_production(quick=False):
-    with cd(this_dir):
-        if local("hg st").strip() != "":
+    with lcd(this_dir):
+        if local("hg st", capture=True).strip() != "":
             if not console.confirm("Project dir is not clean, merge to live will fail. Continue anyway?", default=False):
                 sys.exit()
 
     _deploy(PRODUCTION, quick=quick)
     #  Update 'live' branch so that we can switch to it easily if needed.
-    with cd(this_dir):
+    with lcd(this_dir):
         local('hg update -r live && hg merge -r default && hg commit -m "Merged from default" && hg update -r default', capture=False)
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.