Skip to content

Commit 2e05cfd

Browse files
committed
add test for rst docs and migrate on new itcase sphinx theme fixes #40
1 parent 6a55521 commit 2e05cfd

File tree

5 files changed

+42
-7
lines changed

5 files changed

+42
-7
lines changed

.rstcheck.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[directives]
2+
ignore=automodule,autofunction

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ script:
3535

3636
after_success:
3737
coveralls
38+
./test.sh

docs/conf.py

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

15-
import sys
1615
import os
16+
import shutil
17+
import sys
18+
19+
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
20+
21+
if on_rtd and os.path.exists('_themes'):
22+
shutil.rmtree('_themes')
1723

1824
# Add and use Pylons theme
19-
if 'sphinx-build' in ' '.join(sys.argv): # protect against dumb importers
25+
if 'sphinx-build' in ' '.join(sys.argv) and 'nt' not in os.name:
2026
from subprocess import call, Popen, PIPE
2127

2228
p = Popen('which git', shell=True, stdout=PIPE)
@@ -26,7 +32,7 @@
2632

2733
if not os.path.isdir(_themes):
2834
call([git, 'clone', 'git://github.com/ITCase/itcase_sphinx_theme.git',
29-
'_themes'])
35+
'_themes'])
3036
else:
3137
os.chdir(_themes)
3238
call([git, 'checkout', 'master'])
@@ -39,7 +45,6 @@
3945
sys.path.append(os.path.abspath(parent))
4046
wd = os.getcwd()
4147
os.chdir(parent)
42-
os.system('%s setup.py test -q' % sys.executable)
4348
os.chdir(wd)
4449

4550
for item in os.listdir(parent):
@@ -351,3 +356,4 @@
351356

352357
# If false, no index is generated.
353358
#epub_use_index = True
359+

docs/index.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ API:
2828
Project uses sqlalchemy_mptt
2929
----------------------------
3030

31-
* pyramid_sacrud_pages_
31+
* ps_pages_
3232

3333
.. raw:: html
3434

@@ -47,5 +47,4 @@ Indices and tables
4747
* :ref:`modindex`
4848
* :ref:`search`
4949

50-
51-
.. _pyramid_sacrud_pages: https://github.com/ITCase/pyramid_sacrud_pages
50+
.. _ps_pages: https://github.com/ITCase/ps_pages

test.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#! /bin/bash
2+
#
3+
# test.sh
4+
# Copyright (C) 2015 uralbash <root@uralbash.ru>
5+
#
6+
# Distributed under terms of the MIT license.
7+
#
8+
RED='\033[0;31m'
9+
GREEN='\033[0;32m'
10+
NC='\033[0m' # No Color
11+
PROJECT_NAME='sqlalchemy_mptt'
12+
13+
RST_FILES=`find . -name "*.rst" -printf "%p "`
14+
RST_CHECK=$(rstcheck $RST_FILES --report 2 3>&1 1>&2 2>&3 | tee >(cat - >&2)) # fd=STDERR_FILENO
15+
FLAKE8=$(flake8 ./$PROJECT_NAME/)
16+
17+
echo -e "${RED}"
18+
if [ -n "$RST_CHECK" ] ||
19+
[ -n "$FLAKE8" ]
20+
then
21+
echo -e "RST_CHECK: ${RST_CHECK:-OK}"
22+
echo -e "FLAKE8: ${FLAKE8:-OK}"
23+
exit 1
24+
else
25+
echo -e "${GREEN}OK!"
26+
fi
27+
echo -e "${NC}"

0 commit comments

Comments
 (0)