Skip to content

Commit

Permalink
add test for rst docs and migrate on new itcase sphinx theme fixes #40
Browse files Browse the repository at this point in the history
  • Loading branch information
uralbash committed Apr 20, 2015
1 parent 6a55521 commit 2e05cfd
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .rstcheck.cfg
@@ -0,0 +1,2 @@
[directives]
ignore=automodule,autofunction
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -35,3 +35,4 @@ script:

after_success:
coveralls
./test.sh
14 changes: 10 additions & 4 deletions docs/conf.py
Expand Up @@ -12,11 +12,17 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import shutil
import sys

on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

if on_rtd and os.path.exists('_themes'):
shutil.rmtree('_themes')

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

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

if not os.path.isdir(_themes):
call([git, 'clone', 'git://github.com/ITCase/itcase_sphinx_theme.git',
'_themes'])
'_themes'])
else:
os.chdir(_themes)
call([git, 'checkout', 'master'])
Expand All @@ -39,7 +45,6 @@
sys.path.append(os.path.abspath(parent))
wd = os.getcwd()
os.chdir(parent)
os.system('%s setup.py test -q' % sys.executable)
os.chdir(wd)

for item in os.listdir(parent):
Expand Down Expand Up @@ -351,3 +356,4 @@

# If false, no index is generated.
#epub_use_index = True

5 changes: 2 additions & 3 deletions docs/index.rst
Expand Up @@ -28,7 +28,7 @@ API:
Project uses sqlalchemy_mptt
----------------------------

* pyramid_sacrud_pages_
* ps_pages_

.. raw:: html

Expand All @@ -47,5 +47,4 @@ Indices and tables
* :ref:`modindex`
* :ref:`search`


.. _pyramid_sacrud_pages: https://github.com/ITCase/pyramid_sacrud_pages
.. _ps_pages: https://github.com/ITCase/ps_pages
27 changes: 27 additions & 0 deletions test.sh
@@ -0,0 +1,27 @@
#! /bin/bash
#
# test.sh
# Copyright (C) 2015 uralbash <root@uralbash.ru>
#
# Distributed under terms of the MIT license.
#
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
PROJECT_NAME='sqlalchemy_mptt'

RST_FILES=`find . -name "*.rst" -printf "%p "`
RST_CHECK=$(rstcheck $RST_FILES --report 2 3>&1 1>&2 2>&3 | tee >(cat - >&2)) # fd=STDERR_FILENO
FLAKE8=$(flake8 ./$PROJECT_NAME/)

echo -e "${RED}"
if [ -n "$RST_CHECK" ] ||
[ -n "$FLAKE8" ]
then
echo -e "RST_CHECK: ${RST_CHECK:-OK}"
echo -e "FLAKE8: ${FLAKE8:-OK}"
exit 1
else
echo -e "${GREEN}OK!"
fi
echo -e "${NC}"

0 comments on commit 2e05cfd

Please sign in to comment.