This repository has been archived by the owner on Jun 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
/
fabfile.py
65 lines (48 loc) · 2 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from fabric.api import *
from fabric.contrib.console import confirm
def make_sphinx_branch():
"""
Create a new branch with Sphinx documentation ready to be published
using GitHub's Pages system.
Example usage:
$ fab make_sphinx_branch
Before you can publish your docs, you need to commit them to the repo.
$ git add .
$ git commit -am "First commit"
Then publish the files by pushing them up to GitHub.
$ git push origin gh-pages
Then the docs will appear on GitHub at:
http://<your_account_name>.github.com/<your_repo_name>/
"""
# Create the new branch
local("git branch gh-pages")
# Move into it
local("git checkout gh-pages")
# Install sphinx
local("pip install sphinx")
# Save the dependencies to the requirements file
local("pip freeze > requirements.txt")
# Warn the user of a quirk before configuring with Sphinx
confirm(""". ___ ___ _ ___ ___ _
/\ | | |_ |\ | | | / \ |\ |
/--\ | | |_ | \| | _|_ \_/ | \|
Sphinx is about to start configuring your project.
You can accept the default settings it offers, EXCEPT ONE.
The second question it will ask is:
'Separate source and build directories (y/N) [n]:'
YOU MUST ANSWER YES. THAT MEANS YOU TYPE 'Y' AND PRESS ENTER.
DO YOU UNDERSTAND?""")
# Start up a Sphinx project
local("sphinx-quickstart")
# Create the .nojekyll file GitHub requires
local("touch .nojekyll")
# Make the patches to Sphinx's Makefile we need
local("echo '' >> Makefile")
local("echo 'BUILDDIR = ./' >> Makefile")
local("echo '' >> Makefile")
local("echo 'html:' >> Makefile")
local("echo ' $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)' >> Makefile")
local("echo ' @echo' >> Makefile")
local("echo ' @echo \"Build finished. The HTML pages are in $(BUILDDIR)\"' >> Makefile")
# Make the branch for the first time
local("make html")