-
Notifications
You must be signed in to change notification settings - Fork 1
/
fabfile.py
35 lines (29 loc) · 1021 Bytes
/
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
import tempfile
import shutil
import os
from fabric.operations import local
from fabric.api import lcd
__all__ = ['generate_docs', 'upload_docs']
def generate_docs(clean='no'):
"""Generate the Sphinx documentation."""
c = ""
local('sphinx-apidoc -f -o docs/source/api thriftworker')
if clean.lower() in ['yes', 'y']:
c = "clean "
with lcd('docs'):
local('make %shtml' % c)
def upload_docs():
"""Upload generated documentation to github."""
path = tempfile.mkdtemp()
build = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'docs', 'html')
with lcd(path):
local('git clone git@github.com:blackwithwhite666/thriftworker.git .')
local('git checkout gh-pages')
local('git rm -r .')
local('touch .nojekyll')
local('cp -r ' + build + '/* .')
local('git stage .')
local('git commit -a -m "Documentation updated."')
local('git push origin gh-pages')
shutil.rmtree(path)