-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rewrite/cleanup for documentation builder #277
Merged
Merged
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6ebf671
Add rewrite/cleanup for documentation builder
wdpypere ca50323
remove old quattorpoddoc script.
wdpypere 3fc6839
impove logging on repository map checking.
wdpypere a3afbd0
fix url in setup.py
wdpypere e650335
fix spacing in markdownhandler
wdpypere 5a33c0a
Add capital letters to mailregex
wdpypere 341cf1a
switch from jinja2 to TT.
wdpypere 512a8b3
fix bug in get_basename
wdpypere aad562d
Implement sorted toc.
wdpypere 5ed3818
ignore case when sorting
wdpypere 724fc63
fix pan.tt function arguments bug
wdpypere b21dbd0
implement links
wdpypere bfb3edb
Merge pull request #1 from wdpypere/links
wdpypere 2342e3e
add maven_tools and config files
wdpypere c776c9b
Merge pull request #2 from wdpypere/configfiles
wdpypere File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[run] | ||
omit = | ||
# omit anything in a .local directory anywhere | ||
*/.local/* | ||
# omit everything in /usr | ||
/usr/* | ||
# omit the test directory | ||
*/test/* | ||
# omit everything in /tmp | ||
/tmp/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
## aptana/eclipse | ||
*.project | ||
*.pydevproject | ||
## python | ||
*.pyc | ||
*.pyo | ||
.eggs | ||
## emacs | ||
*~ | ||
.#* | ||
*.orig | ||
*.bak | ||
## Various build products | ||
*.rpm | ||
*.o | ||
*.old | ||
*.DS_Store | ||
*.egg | ||
*.egg-info | ||
.coverage | ||
htmlcov/ | ||
## Python __init__.py files for distributed packages | ||
MANIFEST | ||
dist/ | ||
build/ | ||
setup.cfg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
strictness: veryhigh | ||
test-warnings: true | ||
doc-warnings: true | ||
member-warnings: true | ||
|
||
ignore-paths: | ||
- build | ||
- htmlcov | ||
|
||
pep8: | ||
disable: | ||
options: | ||
max-line-length: 120 | ||
|
||
pep257: | ||
disable: | ||
- D203 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include lib/quattordocbuild/tt/pan.tt | ||
include lib/quattordocbuild/tt/toc.tt | ||
include bin/build-quattor-documentation.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Documentation-builder | ||
--------------------- | ||
|
||
Documentation builder for the Quattor repositories. | ||
|
||
:: | ||
$ quattor-documentation-builder --help | ||
Usage: quattor-documentation-builder [options] | ||
|
||
|
||
Documentation-builder generates markdown documentation. | ||
|
||
It get this from: | ||
- configuration-modules-core perl documentation | ||
- configuration-modules-grid perl documentation | ||
- CAF perl documentation | ||
- CCM perl documentation | ||
- schema pan annotations | ||
and creates a index for the website on http://quattor.org. | ||
@author: Wouter Depypere (Ghent University) | ||
|
||
Options: | ||
-h, --shorthelp show short help message and exit | ||
-H OUTPUT_FORMAT, --help=OUTPUT_FORMAT | ||
show full help message and exit | ||
--confighelp show help as annotated configfile | ||
|
||
Main options (configfile section MAIN): | ||
-p, --codify_paths Put paths inside code tags. (def True) | ||
-i INDEX_NAME, --index_name=INDEX_NAME | ||
Filename for the index/toc for the components. (def mkdocs.yml) | ||
-c, --maven_compile | ||
Execute a maven clean and maven compile before generating the documentation. (def False) | ||
-m MODULES_LOCATION, --modules_location=MODULES_LOCATION | ||
The location of the repo checkout. | ||
-o OUTPUT_LOCATION, --output_location=OUTPUT_LOCATION | ||
The location where the output markdown files should be written to. | ||
-r, --remove_emails | ||
Remove email addresses from generated md files. (def True) | ||
-R, --remove_headers | ||
Remove unneeded headers from files (MAINTAINER and AUTHOR). (def True) | ||
-w, --remove_whitespace | ||
Remove whitespace ( ) from md files. (def True) | ||
-s, --small_titles Decrease the title size in the md files. (def True) | ||
|
||
Debug and logging options (configfile section MAIN): | ||
-d, --debug Enable debug log mode (def False) | ||
--info Enable info log mode (def False) | ||
--quiet Enable quiet/warning log mode (def False) | ||
|
||
|
||
|
||
It makes some assumpions on several repositories being in place. | ||
To help set this up a helper script was added **build-quattor-documentation.sh** which builds the whole documentation from latest master. |
50 changes: 50 additions & 0 deletions
50
src/documentation_builder/bin/build-quattor-documentation.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
VERSION="master" | ||
|
||
#!/bin/bash | ||
while getopts "h:v:" arg; do | ||
case $arg in | ||
h) | ||
echo "usage: use '-v' to specify another branch than master." | ||
;; | ||
s) | ||
VERSION=$OPTARG | ||
;; | ||
esac | ||
done | ||
|
||
for com in 'mkdocs' 'mvn' 'pod2markdown' 'bundle'; do | ||
command -v $com >/dev/null 2>&1 || { echo >&2 "I require $com but it's not installed. Aborting."; exit 1; } | ||
done | ||
|
||
tmpdir="/tmp/quattor-documentation" | ||
|
||
# Create temporary working directory | ||
mkdir -p $tmpdir/{src,output} | ||
cd $tmpdir/src | ||
|
||
# Clone required github repositories | ||
for REPO in CAF configuration-modules-core configuration-modules-grid CCM ; do | ||
git clone https://github.com/quattor/$REPO.git | ||
cd $REPO | ||
tag=`git tag -l | grep "$VERSION$"` | ||
git checkout -q $tag | ||
cd .. | ||
done | ||
cd .. | ||
|
||
# Build the whole documentation | ||
quattor-documentation-builder -c -m $tmpdir/src/ -o $tmpdir/output/ --info || { echo 'Something went wrong building documentation.' ; exit 1 ; } | ||
|
||
# get required index which is not generated | ||
curl https://raw.githubusercontent.com/quattor/documentation/master/docs/index.md -o $tmpdir/output/docs/index.md | ||
|
||
cd $tmpdir/output | ||
mkdocs build --clean | ||
|
||
# Get some tests up | ||
curl https://raw.githubusercontent.com/quattor/documentation/master/Gemfile -o Gemfile | ||
bundle | ||
|
||
bundle exec htmlproofer --check-html ./site/ --file-ignore ./site/base.html,./site/breadcrumbs.html,./site/footer.html,./site/toc.html,./site/versions.html || { echo 'build test errors detected. stopping.' ; exit 1 ; } |
69 changes: 69 additions & 0 deletions
69
src/documentation_builder/bin/quattor-documentation-builder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env python2 | ||
""" | ||
Documentation-builder generates markdown documentation. | ||
|
||
It get this from: | ||
- configuration-modules-core perl documentation | ||
- configuration-modules-grid perl documentation | ||
- CAF perl documentation | ||
- CCM perl documentation | ||
- schema pan annotations | ||
and creates a index for the website on http://quattor.org. | ||
@author: Wouter Depypere (Ghent University) | ||
""" | ||
|
||
import sys | ||
import os | ||
|
||
from vsc.utils import fancylogger | ||
from vsc.utils.generaloption import simple_option | ||
from quattordocbuild.builder import build_documentation | ||
|
||
logger = fancylogger.getLogger() | ||
|
||
REPOMAP = { | ||
"configuration-modules-core": { | ||
"sitesubdir": "components", | ||
"targets": ["/NCM/Component/", "/components/", "/pan/quattor/"] | ||
}, | ||
"configuration-modules-grid":{ | ||
"sitesubdir": "components-grid", | ||
"targets": ["/NCM/Component/", "/components/"] | ||
}, | ||
"CAF": { | ||
"sitesubdir": "CAF", | ||
"targets": ["/CAF/",] | ||
}, | ||
"CCM": { | ||
"sitesubdir": "CCM", | ||
"targets": ["EDG/WP4/CCM/",] | ||
}, | ||
} | ||
|
||
def main(repolocation, outputlocation, maven_compile, cleanup_options): | ||
"""Main run of the script.""" | ||
build_documentation(repolocation, REPOMAP, cleanup_options, maven_compile, outputlocation) | ||
|
||
if __name__ == '__main__': | ||
OPTIONS = { | ||
'modules_location': ('The location of the repo checkout.', None, 'store', None, 'm'), | ||
'output_location': ('The location where the output markdown files should be written to.', None, 'store', None, 'o'), | ||
'maven_compile': ('Execute a maven clean and maven compile before generating the documentation.', None, 'store_true', False, 'c'), | ||
'remove_emails': ('Remove email addresses from generated md files.', None, 'store_true', True, 'r'), | ||
'remove_whitespace': ('Remove whitespace (\n\n\n) from md files.', None, 'store_true', True, 'w'), | ||
'remove_headers': ('Remove unneeded headers from files (MAINTAINER and AUTHOR).', None, 'store_true', True, 'R'), | ||
'small_titles': ('Decrease the title size in the md files.', None, 'store_true', True, 's'), | ||
'codify_paths': ('Put paths inside code tags.', None, 'store_true', True, 'p'), | ||
} | ||
GO = simple_option(OPTIONS) | ||
logger.info("Starting main.") | ||
cleanup_options = { | ||
'remove_emails': GO.options.remove_emails, | ||
'remove_whitespace': GO.options.remove_whitespace, | ||
'remove_headers': GO.options.remove_headers, | ||
'small_titles': GO.options.small_titles, | ||
'codify_paths': GO.options.codify_paths, | ||
} | ||
main(GO.options.modules_location, GO.options.output_location, GO.options.maven_compile, cleanup_options) | ||
logger.info("Done.") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Empty __init__.py.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Empty __init.py__.""" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmmm. either move this to a config file (ini-style) or better yet, add a
.docbuilder.cfg
in each repo with whatever data you need. then you only need to a list of repos here (or query all repos like this PR in release helper quattor/release-helper#1).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea, I'll give that a go!