from fabric.api import run, env, roles
from fabric.contrib.project import rsync_project

env.roledefs = {
    'web': ['bokeh.pydata.org']}

@roles('web')
def deploy(user=False):
    if user:
        env.user = user
    run("rm -rf /www/bokeh-old")
    run("cp -r /www/bokeh-latest /www/bokeh-old")
    rsync_project(
        local_dir="_build/html/",
        remote_dir="/www/bokeh-latest", delete=True)

@@ -254,16 +254,17 @@
 un(%22cp -
+a
 r /www/b
@@ -288,24 +288,92 @@
 bokeh-old%22)%0A
+    run(%22rm /www/bokeh%22)%0A    run(%22ln -s /www/bokeh-old /www/bokeh%22)%0A
     rsync_pr
@@ -466,8 +466,121 @@
 e=True)%0A
+    run(%22rm /www/bokeh%22)%0A    run(%22ln -s /www/bokeh-latest /www/bokeh%22)%0A    run(%22chmod -R g+w /www/bokeh-latest%22)%0A

allow different user