Skip to content

Commit 28b3397

Browse files
committed
Migrate from GitHub pages to Read the Docs
This changes the documentation build process to work on Read the Docs. Included are style changes to give the RTD version selection box a different style which is consistent with our custom website theme. The docs readme has been updated and the sphinx makefile has had its gh-pages specific rules removed. Preview available at http://errbot.readthedocs.org/
1 parent 9479108 commit 28b3397

File tree

10 files changed

+97
-55
lines changed

10 files changed

+97
-55
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ nohup.out
1111
/config-*.egg
1212
/config*.py
1313
/docs/_build
14-
/docs/_gh-pages
1514
/docs/errbot.rst
1615
/docs/errbot.*.rst
1716
/.cache

docs/Makefile

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44
# You can set these variables from the command line.
55
SPHINXOPTS =
66
SPHINXBUILD = sphinx-build
7-
SPHINXAPIDOC = sphinx-apidoc
87
PAPER =
98
BUILDDIR = _build
10-
PAGESURL = [email protected]:errbotio/errbot.git
11-
PAGESDIR = _gh-pages
129
EXTRADIR = _extra
1310

1411
# User-friendly check for sphinx-build
@@ -23,7 +20,7 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
2320
# the i18n builder cannot share the environment and doctrees with the others
2421
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
2522

26-
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext gh-pages apidoc
23+
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
2724

2825
help:
2926
@echo "Please use \`make <target>' where <target> is one of"
@@ -53,25 +50,12 @@ help:
5350
clean:
5451
rm -rf $(BUILDDIR)/*
5552

56-
gh-pages: clean apidoc html
57-
test -e $(PAGESDIR) && (cd $(PAGESDIR) && git pull) || git clone $(PAGESURL) $(PAGESDIR)
58-
cd $(PAGESDIR) && git checkout gh-pages
59-
rm -rf $(PAGESDIR)/*
60-
cp -r $(BUILDDIR)/html/* $(PAGESDIR)/
61-
cp -r $(EXTRADIR)/* $(EXTRADIR)/.nojekyll $(PAGESDIR)/
62-
cd $(PAGESDIR) && git add --all . && git commit --message "Sphinx autobuild"
63-
@echo
64-
@echo "GitHub pages are built and ready, just waiting to be pushed from the $(PAGESDIR) directory"
65-
66-
apidoc:
67-
$(SPHINXAPIDOC) --separate -f -o . ../errbot
68-
69-
html: apidoc
53+
html:
7054
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
7155
@echo
7256
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
7357

74-
dirhtml: apidoc
58+
dirhtml:
7559
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
7660
@echo
7761
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."

docs/README.rst

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,35 @@ Errbot's website and documentation are built using `Sphinx`_. Useful
55
references when contributing to the docs are the `reStructuredText Primer`_
66
and `Inline markup`_ documents.
77

8+
89
Requirements
910
------------
1011

1112
Documentation *must* be built using Python 3. Additionally, extra requirements
12-
must be installed, which may be done through `pip install -r requirements.txt`.
13+
must be installed, which may be done through `pip install -r docs/requirements.txt`
14+
(note: you must run this from the root of the repository).
1315

1416
You must also have make installed in order to use the supplied Makefile.
1517

18+
1619
Building and viewing locally
1720
----------------------------
1821

1922
With the necessary requirements installed, the documentation can be built using
2023
the command `make html`. Once generated, the resulting pages can be viewed by
2124
opening `_build/html/index.html` in your webbrowser of choice.
2225

23-
Publishing to GitHub pages
24-
--------------------------
25-
26-
*Note: This is only relevant to project maintainers*
27-
28-
The `make gh-pages` command can be used to build output for GitHub pages. This
29-
will pull down a copy of the repository and auto-commit to the gh-pages branch.
30-
The results of this can then be reviewed before being pushed.
3126

32-
There is a `Jenkins job <https://jenkins.errbot.net/job/Publish%20errbot.io/>`_
33-
which will do all of the above automatically on commits.
34-
Whenever a new version of errbot is released, the version number on this Jenkins
35-
job will need to be updated
36-
(look for *"Branch Specifier"* under *"Branches to build"*).
27+
Publishing to Read the Docs
28+
---------------------------
3729

30+
*Note: This is only relevant to project maintainers*
3831

39-
Including extra files with GitHub pages
40-
---------------------------------------
32+
Read the Docs should rebuild the site automatically when new commits are pushed.
33+
When new project releases are made, it may be necessary to add the new version
34+
and remove older versions (to prevent clutter in the version drop-down).
35+
This can be done at https://readthedocs.org/dashboard/errbot/versions/.
4136

42-
All the files found within the `_extra` directory are copied to the root of
43-
the output directory (after a successful Sphinx build) during the processing
44-
of `make gh-pages`.
4537

4638
.. _Sphinx: http://sphinx-doc.org/
4739
.. _reStructuredText Primer: http://sphinx-doc.org/rest.html

docs/_extra/.nojekyll

Whitespace-only changes.

docs/_extra/CNAME

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/_extra/version

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/_themes/err/layout.html

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33
<!doctype html>
44
{% endblock %}
55
{%- block extrahead %}
6-
<script type="text/javascript">
7-
// GitHub pages offers no way to redirect to a canonical location, so we
8-
// have to make do with hacky javascript redirection :(
9-
if (document.location.protocol != "file:" && document.location.host != "errbot.io") {
10-
var path = document.location.pathname.replace('/err/', '/');
11-
document.location = "http://errbot.io" + path;
12-
}
13-
</script>
146
<link rel="icon" type="image/png" href="{{ pathto('_static/err.png', 1) }}"/>
157
<link rel="apple-touch-icon" href="{{ pathto('_static/err.png', 1) }}"/>
168
<link rel="stylesheet" href="{{ pathto('_static/' ~ "fancybox/jquery.fancybox.css", 1) }}" type="text/css"
@@ -44,9 +36,9 @@
4436
<img class="logo" src="{{ pathto('_static/err_speech.png', 1) }}" width="220" height="135" alt="Logo of Err"/>
4537
</a>
4638
<div class="ghbuttons">
47-
<iframe src="http://ghbtns.com/github-btn.html?user=errbotio&repo=errbot&type=watch&count=true"
39+
<iframe src="//ghbtns.com/github-btn.html?user=errbotio&repo=errbot&type=watch&count=true"
4840
allowtransparency="true" frameborder="0" scrolling="0" width="95" height="20"></iframe>
49-
<iframe src="http://ghbtns.com/github-btn.html?user=errbotio&repo=errbot&type=fork&count=true" allowtransparency="true"
41+
<iframe src="//ghbtns.com/github-btn.html?user=errbotio&repo=errbot&type=fork&count=true" allowtransparency="true"
5042
frameborder="0" scrolling="0" width="95" height="20"></iframe>
5143
</div>
5244
{%- endblock %}

docs/_themes/err/static/err.css_t

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
{% set code_font = "'Droid Sans Mono', monospace" %}
1010
{% set normal_link_color = "#f07e2a" %}
1111
{% set normal_link_hover_color = "#f07e2a" %}
12+
{% set highlight_color = "#f07e2a" %}
1213

1314
/* 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; */
1415

1516
@import url("basic.css");
16-
@import url(http://fonts.googleapis.com/css?family=Open+Sans|Droid+Sans+Mono);
17+
@import url(//fonts.googleapis.com/css?family=Open+Sans|Droid+Sans+Mono);
1718

1819
/* -- page layout ----------------------------------------------------------- */
1920

@@ -465,7 +466,9 @@ div.screenshots a {
465466
display: none;
466467
}
467468

468-
469+
html body div.indexwrapper div.related ul li.right {
470+
padding: 10px 0 20px;
471+
}
469472

470473
}
471474

@@ -627,3 +630,71 @@ body #prev_next_links {
627630
padding: 0;
628631
text-align: center;
629632
}
633+
634+
635+
/* -- Gitter sidecar button ------------------------------------------------- */
636+
637+
.gitter-open-chat-button {
638+
background-color: {{ highlight_color }} !important;
639+
}
640+
641+
642+
/* -- Read the Docs version selector ---------------------------------------- */
643+
644+
.rst-versions .rst-current-version {
645+
color: #fff !important;
646+
background: {{ highlight_color }} !important;
647+
}
648+
649+
.rst-versions.rst-badge.shift-up .rst-current-version {
650+
border-bottom-left-radius: 0;
651+
border-bottom-right-radius: 0;
652+
}
653+
654+
.rst-versions.rst-badge.shift-up .rst-current-version .fa-book {
655+
float: none !important;
656+
}
657+
658+
.rst-versions .rst-other-versions hr {
659+
border-color: #fafafa !important;
660+
}
661+
662+
.rst-versions.rst-badge .rst-current-version {
663+
color: #fff !important;
664+
background: {{ highlight_color }} !important;
665+
position: fixed !important;
666+
right: 35px !important;
667+
top: 0 !important;
668+
padding: 1px 15px !important;
669+
border-bottom-left-radius: 0.5em;
670+
border-bottom-right-radius: 0.5em;
671+
}
672+
673+
.rst-versions .rst-other-versions {
674+
color: #fff !important;
675+
background: {{ highlight_color }} !important;
676+
position: fixed !important;
677+
right: 35px !important;
678+
top: 30px !important;
679+
border-top-left-radius: 0.5em;
680+
border-bottom-left-radius: 0.5em;
681+
border-bottom-right-radius: 0.5em;
682+
}
683+
684+
.rst-versions a {
685+
text-decoration: underline;
686+
color: #fff !important;
687+
}
688+
689+
.rst-versions .rst-other-versions dl dt {
690+
text-decoration: underline;
691+
font-style: italic;
692+
}
693+
694+
.rst-versions .rst-other-versions a {
695+
text-decoration: underline;
696+
}
697+
698+
.rst-versions .rst-other-versions dl dd a {
699+
text-decoration: none;
700+
}

docs/conf.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# All configuration values have a default; values that are commented out
1313
# serve to show the default.
1414

15-
import sys, os
15+
import subprocess, sys, os
1616
sys.path.append(os.path.abspath('_themes'))
1717
sys.path.append(os.path.abspath('_themes/err'))
1818
sys.path.append(os.path.abspath('../'))
@@ -115,6 +115,11 @@ def autodoc_skip_member(app, what, name, obj, skip, options):
115115
return False
116116
return skip
117117

118+
# -- Apidoc --------------------------------------------------------------------
119+
120+
def run_apidoc(_):
121+
subprocess.check_call("sphinx-apidoc --separate -f -o . ../errbot", shell=True)
122+
118123
# -- Options for HTML output ---------------------------------------------------
119124

120125
# The theme to use for HTML and HTML Help pages. See the documentation for
@@ -309,3 +314,4 @@ def autodoc_skip_member(app, what, name, obj, skip, options):
309314

310315
def setup(app):
311316
app.connect("autodoc-skip-member", autodoc_skip_member)
317+
app.connect("builder-inited", run_apidoc)

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sphinx>=1.2
44
# is fixed and included into a new release.
55
https://github.com/zoni/sphinx-autodoc-annotation/archive/issue-2.zip
66

7-
-e ../.
7+
-e .
88
sleekxmpp
99
irc
1010
pyfire

0 commit comments

Comments
 (0)