forked from PythonJournos/refactoring101
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
47 lines (40 loc) · 1.23 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
43
44
45
46
47
import os
from fabric.api import *
#def readme_to_rst():
# """
# Convert README.md to _docs/index.rst for Sphinx.
# Convert the GitHub-friendly README.md to a Sphinx-friendly reStructured text file.
# """
#
# print "Converting markdown to reStructured text."
#
# # Try to run the pandoc command to convert our file.
# test_pandoc = os.system('pandoc -s README.md -o _docs/index.rst')
#
# # If this fails to run for any reason, assume it's not installed and send a nice message.
# if test_pandoc != 0:
# print "You don't have pandoc installed! Go get it!\nhttp://johnmacfarlane.net/pandoc/installing.html"
#
# return False
#
# return True
def build_sphinx_html():
"""
Build HTML with Sphinx for our readme.
Converts _docs/index.rst into a fancy HTML page with search and everything.
"""
os.system('rm -rf html')
os.system('cd _docs && make html')
def serve_sphinx():
"""
Serve Sphinx HTML for Web browsers.
Runs the Python SimpleHTTPServer on port 8000.
"""
print "Open a Web browser to http://127.0.0.1:8000/\n"
os.system('cd html && python -m SimpleHTTPServer')
def bootstrap_docs():
"""
Setup docs.
"""
build_sphinx_html()
serve_sphinx()