Skip to content

Commit ee847e4

Browse files
committed
Markdown Documentation Framework
This framework stores documentation as markdown files. - Documentation is automatically converted to html and is pushed to gh-pages version\latest - A tag will start a build and the html pages will be pushed to gh-pages version\tagname It uses [mkdocs](www.mkdocs.org) to generate html from these documents. File Changed: - .gitattributes removed tools, renamed docsource to docs - .gitignore - Add site/, removed docs docsource/project/Data/ & docs/ - .gitmodules - Removed link to NaturalDocs - readme.md - Update directories section to reflect this change - .travis.yml - Change distribution to trusty (python/nodejs access), install mkdocs Added: - .travis/build_docs.sh - Shell script run from the root of the repository to generated documentation - .travis/pushe_docs_to_gh_pages.sh - Shell script run from root to push html docs to gh-pages - .travis/python_req.txt - Used by pip to install python required libraries. - mkdocs.yml - Mkdocs configuration file to control documentation - docs/ - Several Markdown files containing an initial set of documentation. Removed - docsource directory (NaturalDocs topic files and project configuration) - tools directory (Natualdocs)
1 parent 1408761 commit ee847e4

32 files changed

Lines changed: 354 additions & 633 deletions

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@
55
.travis.yml export-ignore
66

77
.travis export-ignore
8-
tools export-ignore
98

10-
^docsource/* linguist-documentation
9+
^docs/* linguist-documentation

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
55
# User-specific stuff:
66
.idea/
7-
docsource/project/Data/
8-
docs/
7+
site/
8+
pages/

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "tools/ndocs"]
2-
path = tools/ndocs
3-
url = https://github.com/rlove/NaturalDocs.git

.travis.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
sudo: required
2-
3-
language: perl
2+
language: python
43

54
env:
65
global:
@@ -19,6 +18,9 @@ env:
1918
- UT3_USER=ut3
2019
- UT3_PASSWORD=ut3
2120
- UT3_TABLESPACE=users
21+
# Target Branch and Directory for Deployment of Docs
22+
- PAGES_TARGET_BRANCH="gh-pages"
23+
- PAGES_VERSION_BASE="version3"
2224

2325
addons:
2426
apt:
@@ -27,7 +29,6 @@ addons:
2729
- bc
2830
- rpm
2931
- unzip
30-
# - libaio1
3132

3233

3334
cache:
@@ -36,25 +37,23 @@ cache:
3637
- $HOME/.cache
3738

3839
before_install:
39-
# perl modules needed for documenation generation
40-
- "cpanm IPC::System::Simple"
41-
- "cpanm Markdent"
42-
- "cpanm File::Map"
4340
# On trusty, download the zip file into a cachable directory
4441
- test "$DIST" = precise || export ORACLE_ZIP_DIR=$HOME/.cache
4542
# If the zip file already exists, do not download it again
4643
- test -f "$ORACLE_ZIP_DIR"/$(basename $ORACLE_FILE) || bash .travis/oracle/download.sh
4744

4845
install:
46+
- sudo pip install -r .travis/python_req.txt
4947
- bash .travis/oracle/install.sh
50-
48+
5149
script:
5250
- bash .travis/create_utplsql_user.sh
5351
- bash .travis/install_libraries.sh
5452
- bash .travis/install.sh
5553
- bash .travis/run_examples.sh
5654
- bash .travis/run_test.sh
57-
- perl docsource/builddocs.pl
55+
- bash .travis/build_docs.sh
56+
- bash .travis/push_docs_to_gh_pages.sh
5857

5958
notifications:
6059
slack: utplsql:oiMuXO95TvKeAUENuDt4cPrB

.travis/build_docs.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
mkdocs build --clean --strict

.travis/push_docs_to_gh_pages.sh

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
#!/bin/bash
2+
3+
# Many aspsects of this came from https://gist.github.com/domenic/ec8b0fc8ab45f39403dd
4+
# Significant alterations
5+
# - Avoid pulling all history for cloned repo
6+
# - Support for multiple copies of documenation,
7+
# - only clearing out latest
8+
# - doc-history.md logging doc history
9+
# - Wrapped calls with actual encrypt keys with > /dev/null 2> /dev/null4
10+
11+
# How to run:
12+
# - From repository root .travis/push_docs_to_gh_pages.sh
13+
14+
# Required files / directories (relative from repo root)
15+
# - Folder : "site" with that contains latest docs
16+
# - File : ".travis/deploy_key.enc" SSH deployment key encrypted by Travis command line tool
17+
18+
# Required ENV Variables
19+
# ENCRYPTION_LABEL - Manually Set in travis web settings. Value can be displayed in LOG
20+
# encrypted_${ENCRYPTION_LABEL}_key - Set in web settings using travis cmdline encryption
21+
# encrypted_${ENCRYPTION_LABEL}_iv - Set in web settings using travis cmdline encryption
22+
# PAGES_TARGET_BRANCH="gh-pages" - Set in .travis.yml, branch were pages will be deployed
23+
# PAGES_VERSION_BASE="version3" -Set in .travis.yml, directory for pages deployment
24+
# TRAVIS_* variables are set by travis directly and only need to be if testing externally
25+
26+
# Pull requests are special...
27+
# They won't have acceess to the encrypted variables.
28+
# This prevent access to the Encrypted SSH Key
29+
# Regardless we don't want a pull request automatically updating the repository
30+
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
31+
32+
# ENV Variable checks are to help with configuration troubleshooting
33+
# they silently exit with unique message. Anyone one of them not set
34+
# can be used to turn off this functionality.
35+
# For example a feature branch in the master repository that we don't want docs produced for yet.
36+
[[ -n "$PAGES_VERSION_BASE" ]] || { echo "PAGES_VERSION_BASE Missing"; exit 0; }
37+
[[ -n "$PAGES_TARGET_BRANCH" ]] || { echo "PAGES_TARGET_BRANCH Missing"; exit 0; }
38+
[[ -n "$ENCRYPTION_LABEL" ]] || { echo "ENCRYPTION_LABEL Missing"; exit 0; }
39+
40+
# Fail because required script to generate documenation must have not been run, or was changed.
41+
[[ -d ./site ]] || { echo "site directory not found"; exit 1; }
42+
43+
# Save some useful information
44+
REPO=`git config remote.origin.url`
45+
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
46+
SHA=`git rev-parse --verify HEAD`
47+
48+
# shallow clone the repostoriy and switch to PAGES_TARGET_BRANCH branch
49+
mkdir pages
50+
cd pages
51+
git clone --depth 1 $REPO .
52+
PAGES_BRANCH_EXISTS=$(git ls-remote --heads $REPO $PAGES_TARGET_BRANCH)
53+
54+
if [ -n "$PAGES_BRANCH_EXISTS" ] ; then
55+
echo "Pages Branch Found"
56+
echo "-$PAGES_BRANCH_EXISTS-"
57+
git remote set-branches origin $PAGES_TARGET_BRANCH
58+
git fetch --depth 1 origin $PAGES_TARGET_BRANCH
59+
git checkout $PAGES_TARGET_BRANCH
60+
else
61+
echo "Creating Pages Branch"
62+
git checkout --orphan $PAGES_TARGET_BRANCH
63+
git rm -rf .
64+
fi
65+
66+
#clear out latest and copy site contents to it.
67+
echo "updating $VERSION_BASE/latest"
68+
mkdir -p $PAGES_VERSION_BASE/latest
69+
rm -rf $PAGES_VERSION_BASE/latest/**./* || exit 0
70+
cp -a ../site/. $PAGES_VERSION_BASE/latest
71+
72+
# If a Tagged Build then copy to it's own directory as well.
73+
if [ -n "$TRAVIS_TAG" ]; then
74+
echo "Creating $PAGES_VERSION_BASE/$TRAVIS_TAG"
75+
mkdir -p $PAGES_VERSION_BASE/$TRAVIS_TAG || exit 0
76+
cp -a ../site/. $PAGES_VERSION_BASE/$TRAVIS_TAG
77+
fi
78+
79+
#Check if there are doc changes, if none exit the script
80+
if [[ -z `git diff --exit-code` ]] && [ -n "$PAGES_BRANCH_EXISTS" ] ; then
81+
echo "No changes to docs detected."
82+
exit 0
83+
fi
84+
85+
#Chganges where detected, so it's safe to write to log.
86+
now=$(date +"%d %b %Y - %r")
87+
export latest=" - [Latest Doc Change]($PAGES_VERSION_BASE/latest/) - Created $now"
88+
if [ ! -f doc-history.md ]; then
89+
echo "<!-- Auto generated in .travis/push_docs_to_gh_pages.sh -->" >doc-history.md
90+
echo "#Doc Generation Log" >>doc-history.md
91+
echo "" >>doc-history.md
92+
echo "- 4th line placeholder see below" >>doc-history.md
93+
echo "" >>doc-history.md
94+
echo "##Released Version Doc History" >>doc-history.md
95+
echo "" >>doc-history.md
96+
fi
97+
if [ -n "$TRAVIS_TAG" ]; then
98+
echo " - [$TRAVIS_TAG]($PAGES_VERSION_BASE/$TRAVIS_TAG/) - Created $now" >>doc-history.md
99+
fi
100+
101+
#replace 4th line in log
102+
sed -i '4s@.*@'"$latest"'@' doc-history.md
103+
104+
#Setup Git with Commiter info
105+
git config user.name "Travis CI"
106+
git config user.email "utplsql@users.noreply.github.com"
107+
108+
#Add and Commit the changes back to pages repo.
109+
git add .
110+
git commit -m "Deploy to GitHub Pages: ${SHA}"
111+
112+
#unencrypt and configure deployment key
113+
[[ -e ../.travis/deploy_key.enc ]] || { echo ".travis/deploy_key.enc file not found"; exit 1; }
114+
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
115+
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
116+
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR} > /dev/null 2> /dev/null
117+
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR} > /dev/null 2> /dev/null
118+
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in ../.travis/deploy_key.enc -out ../.travis/deploy_key -d > /dev/null 2> /dev/null
119+
chmod 600 ../.travis/deploy_key
120+
eval `ssh-agent -s`
121+
ssh-add ../.travis/deploy_key
122+
123+
# Now that we're all set up, we can push.
124+
echo "git push $SSH_REPO $PAGES_TARGET_BRANCH"
125+
git push $SSH_REPO $PAGES_TARGET_BRANCH
126+
fi

.travis/python_req.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mkdocs

docs/about/license.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#Version Information
2+
3+
**utPLSQL version 3** is licensed under [Apache 2.0]
4+
(https://www.apache.org/licenses/LICENSE-2.0)
5+
6+
External code used in the development of this project, but is not required for use.
7+
8+
| Tool | License | Purpose |
9+
| ---- | --------| --------|
10+
| [Travis-Oracle](https://github.com/cbandy/travis-oracle) | [ISC](https://github.com/cbandy/travis-oracle/blob/master/LICENSE) | Install Oracle for Travis Builds |
11+
| [mkDocs](http://www.mkdocs.org/) | [BSD](http://www.mkdocs.org/about/license/) | Produce HTML version of documentation |
12+
13+
**Note:** Version 1 & 2 of utPLSQL were licensed under GPL, version 3 was a complete rewrite from scratch which a allowed us to change the license to a more permissive license.

docs/about/project-details.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# utPLSQL Project Details
2+
3+
[![chat](http://img.shields.io/badge/GitHub_Project-Active-blue.svg)](https://github.com/utPLSQL/utPLSQL)
4+
[![license](http://img.shields.io/badge/license-apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
5+
[![chat](http://img.shields.io/badge/chat-slack-blue.svg)](http://utplsql-slack-invite.herokuapp.com/)
6+
[![twitter](https://img.shields.io/twitter/follow/utPLSQL.svg?style=social&label=Follow)](https://twitter.com/utPLSQL)
7+
8+
9+
utPLSQL is hosted on [hosted on GitHub](https://github.com/utPLSQL/utPLSQL) and open source project.
10+
11+
Community help on this project is always appreciated, if your interested in helping please read our [guide to contributing](https://github.com/utPLSQL/utPLSQL/blob/master/CONTRIBUTING.md)
12+
13+
14+
15+

docs/about/support.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# How to get support
2+
3+
4+
- Feel free post questions, bugs or issues]to the [issues area of GitHub](https://github.com/utPLSQL/utPLSQL/issues).
5+
- Join developers the [utPLSQL team](http://utplsql-slack-invite.herokuapp.com) on [Slack](https://slack.com/)

0 commit comments

Comments
 (0)