forked from bokeh/bokeh
-
Notifications
You must be signed in to change notification settings - Fork 12
/
fabfile.py
42 lines (34 loc) · 1.33 KB
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from fabric.api import run, env, roles, put
from fabric.contrib.project import rsync_project
env.roledefs = {
'web': ['bokeh.pydata.org']}
dirs = ['_images', '_sources', '_static', 'docs', 'tutorial']
files = ['genindex.html', 'index.html', 'objects.inv', 'py-modindex.html', 'search.html', 'searchindex.js']
@roles('web')
def deploy(user=False):
if user:
env.user = user
# remove and archive old files and directories
for dir in dirs:
run("rm -rf /www/bokeh-old/%s" % dir)
run("cp -ar /www/bokeh-latest/%s /www/bokeh-old/%s" % (dir, dir))
for file in files:
run("rm -f /www/bokeh-old/%s" % file)
run("cp -a /www/bokeh-latest/%s /www/bokeh-old/%s" % (file, file))
# switch current symlink to archive docs
run("rm /www/bokeh")
run("ln -s /www/bokeh-old /www/bokeh")
# upload the new files and directories
for dir in dirs:
rsync_project(
local_dir="_build/html/%s/" % dir,
remote_dir="/www/bokeh-latest/%s" % dir, delete=True)
for file in files:
put(
local_path="_build/html/%s" % file,
remote_path="/www/bokeh-latest/%s" % file)
# switch the current symlink to new docs
run("rm /www/bokeh")
run("ln -s /www/bokeh-latest /www/bokeh")
# set permissions
run("chmod -R g+w /www/bokeh-latest")