1
0
Fork 0

backport documentation variable configurations (#3850)

* Correct custom search IDs, sitemap and edit URLs

* deploy versions through shell script from central places

* shellcheckify

* shellcheck, indent

* move all configs into one file

* add settings

* one more char that may occur in ids

* add per book version, its not yet the right ids.

* Update VERSIONS

Created new CSE for Devel Cookbook, replaced all IDs by Devel CSE IDs, adjusted prio to 0.3
This commit is contained in:
Wilfried Goesgens 2017-12-05 14:11:21 +01:00 committed by Jan
parent 64f259aa70
commit 3fe4b2fda5
10 changed files with 395 additions and 312 deletions

View File

@ -37,8 +37,8 @@
},
"sitemap-general": {
"prefix": "https://docs.arangodb.com/devel/AQL/",
"changefreq": "daily",
"priority": 0.3
"changefreq": "@GCHANGE_FREQ@",
"priority": @GPRIORITY@
},
"ga": {
"token": "UA-81053435-2"

View File

@ -1,4 +1,7 @@
// Try to set the version number early, jQuery not available yet
var searcheable_versions = [@BROWSEABLE_VERSIONS@];
var cx = '@GSEARCH_ID@';
document.addEventListener("DOMContentLoaded", function(event) {
if (!gitbook.state.root) return;
var bookVersion = gitbook.state.root.match(/\/(\d\.\d(\.\d)?|devel)\//);
@ -16,7 +19,22 @@ window.localStorage.removeItem(":keyword");
$(document).ready(function() {
function appendHeader() {
var VERSION_SELECTOR = ""
var i = 0;
var prefix;
for (i = 0; i < searcheable_versions.length; i++ ) {
if (searcheable_versions[i] === 'devel') {
prefix = '';
} else {
prefix = 'v';
}
VERSION_SELECTOR += '<option value="' +
searcheable_versions[i] +
'">' + prefix +
searcheable_versions[i] +
'</option>\n';
}
var div = document.createElement('div');
div.innerHTML = '<div class="arangodb-header">\n' +
' <div class="arangodb-logo">\n' +
@ -30,11 +48,7 @@ function appendHeader() {
' </a>\n' +
' </div>\n' +
' <select class="arangodb-version-switcher">\n' +
' <option value="devel">devel</option>\n' +
' <option value="3.2">v3.2</option>\n' +
' <option value="3.1">v3.1</option>\n' +
' <option value="3.0">v3.0</option>\n' +
' <option value="2.8">v2.8</option>\n' +
VERSION_SELECTOR +
' </select>\n' +
' <div class="google-search">\n' +
' <gcse:searchbox-only></gcse:searchbox-only>\n' +
@ -93,7 +107,6 @@ function appendHeader() {
//render header
rerenderNavbar();
function addGoogleSrc() {
var cx = '010085642145132923492:6ymjhhr677k';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;

View File

@ -36,15 +36,15 @@
"css": ["styles/header.css"]
},
"sitemap-general": {
"prefix": "https://docs.arangodb.com/3.2/cookbook/",
"changefreq": "weekly",
"priority": 0.8
"prefix": "https://docs.arangodb.com/devel/cookbook/",
"changefreq": "@GCHANGE_FREQ@",
"priority": @GPRIORITY@
},
"ga": {
"token": "UA-81053435-2"
},
"edit-link": {
"base": "https://github.com/arangodb/Cookbook/edit/master/recipes",
"base": "https://github.com/arangodb/arangodb/edit/devel/Documentation/Books/Cookbook",
"label": "Edit Page"
},
"localized-footer": {

View File

@ -1,4 +1,7 @@
// Try to set the version number early, jQuery not available yet
var searcheable_versions = [@BROWSEABLE_VERSIONS@];
var cx = '@GSEARCH_ID@';
document.addEventListener("DOMContentLoaded", function(event) {
if (!gitbook.state.root) return;
var bookVersion = gitbook.state.root.match(/\/(\d\.\d(\.\d)?|devel)\//);
@ -16,6 +19,21 @@ window.localStorage.removeItem(":keyword");
$(document).ready(function() {
function appendHeader() {
var VERSION_SELECTOR = ""
var i = 0;
var prefix;
for (i = 0; i < searcheable_versions.length; i++ ) {
if (searcheable_versions[i] === 'devel') {
prefix = '';
} else {
prefix = 'v';
}
VERSION_SELECTOR += '<option value="' +
searcheable_versions[i] +
'">' + prefix +
searcheable_versions[i] +
'</option>\n';
}
var div = document.createElement('div');
div.innerHTML = '<div class="arangodb-header">\n' +
@ -30,11 +48,7 @@ function appendHeader() {
' </a>\n' +
' </div>\n' +
' <select class="arangodb-version-switcher">\n' +
' <option value="devel">devel</option>\n' +
' <option value="3.2">v3.2</option>\n' +
' <option value="3.1">v3.1</option>\n' +
' <option value="3.0">v3.0</option>\n' +
' <option value="2.8">v2.8</option>\n' +
VERSION_SELECTOR +
' </select>\n' +
' <div class="google-search">\n' +
' <gcse:searchbox-only></gcse:searchbox-only>\n' +
@ -93,7 +107,6 @@ function appendHeader() {
//render header
rerenderNavbar();
function addGoogleSrc() {
var cx = '010085642145132923492:ol7d_ppmq48';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;

View File

@ -37,8 +37,8 @@
},
"sitemap-general": {
"prefix": "https://docs.arangodb.com/devel/HTTP/",
"changefreq": "daily",
"priority": 0.3
"changefreq": "@GCHANGE_FREQ@",
"priority": @GPRIORITY@
},
"ga": {
"token": "UA-81053435-2"

View File

@ -1,4 +1,6 @@
// Try to set the version number early, jQuery not available yet
var searcheable_versions = [@BROWSEABLE_VERSIONS@];
var cx = '@GSEARCH_ID@';
document.addEventListener("DOMContentLoaded", function(event) {
if (!gitbook.state.root) return;
var bookVersion = gitbook.state.root.match(/\/(\d\.\d(\.\d)?|devel)\//);
@ -16,6 +18,21 @@ window.localStorage.removeItem(":keyword");
$(document).ready(function() {
function appendHeader() {
var VERSION_SELECTOR = ""
var i = 0;
var prefix;
for (i = 0; i < searcheable_versions.length; i++ ) {
if (searcheable_versions[i] === 'devel') {
prefix = '';
} else {
prefix = 'v';
}
VERSION_SELECTOR += '<option value="' +
searcheable_versions[i] +
'">' + prefix +
searcheable_versions[i] +
'</option>\n';
}
var div = document.createElement('div');
div.innerHTML = '<div class="arangodb-header">\n' +
@ -30,11 +47,7 @@ function appendHeader() {
' </a>\n' +
' </div>\n' +
' <select class="arangodb-version-switcher">\n' +
' <option value="devel">devel</option>\n' +
' <option value="3.2">v3.2</option>\n' +
' <option value="3.1">v3.1</option>\n' +
' <option value="3.0">v3.0</option>\n' +
' <option value="2.8">v2.8</option>\n' +
VERSION_SELECTOR +
' </select>\n' +
' <div class="google-search">\n' +
' <gcse:searchbox-only></gcse:searchbox-only>\n' +
@ -93,7 +106,6 @@ function appendHeader() {
//render header
rerenderNavbar();
function addGoogleSrc() {
var cx = '010085642145132923492:fixi4yzeiz8';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;

View File

@ -37,8 +37,8 @@
},
"sitemap-general": {
"prefix": "https://docs.arangodb.com/devel/Manual/",
"changefreq": "daily",
"priority": 0.3
"changefreq": "@GCHANGE_FREQ@",
"priority": @GPRIORITY@
},
"ga": {
"token": "UA-81053435-2"

View File

@ -1,4 +1,6 @@
// Try to set the version number early, jQuery not available yet
var searcheable_versions = [@BROWSEABLE_VERSIONS@];
var cx = '@GSEARCH_ID@';
document.addEventListener("DOMContentLoaded", function(event) {
if (!gitbook.state.root) return;
var bookVersion = gitbook.state.root.match(/\/(\d\.\d(\.\d)?|devel)\//);
@ -16,6 +18,21 @@ window.localStorage.removeItem(":keyword");
$(document).ready(function() {
function appendHeader() {
var VERSION_SELECTOR = ""
var i = 0;
var prefix;
for (i = 0; i < searcheable_versions.length; i++ ) {
if (searcheable_versions[i] === 'devel') {
prefix = '';
} else {
prefix = 'v';
}
VERSION_SELECTOR += '<option value="' +
searcheable_versions[i] +
'">' + prefix +
searcheable_versions[i] +
'</option>\n';
}
var div = document.createElement('div');
div.innerHTML = '<div class="arangodb-header">\n' +
@ -30,11 +47,7 @@ function appendHeader() {
' </a>\n' +
' </div>\n' +
' <select class="arangodb-version-switcher">\n' +
' <option value="devel">devel</option>\n' +
' <option value="3.2">v3.2</option>\n' +
' <option value="3.1">v3.1</option>\n' +
' <option value="3.0">v3.0</option>\n' +
' <option value="2.8">v2.8</option>\n' +
VERSION_SELECTOR +
' </select>\n' +
' <div class="google-search">\n' +
' <gcse:searchbox-only></gcse:searchbox-only>\n' +
@ -93,7 +106,6 @@ function appendHeader() {
//render header
rerenderNavbar();
function addGoogleSrc() {
var cx = '010085642145132923492:djexw6vlsgo';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;

View File

@ -2,38 +2,54 @@
ALLBOOKS="HTTP AQL Manual Cookbook"
OTHER_MIME="pdf epub mobi"
# shellcheck disable=SC2016
TRIPPLETICS='```'
declare -A COLORS
declare -A C
COLORS[RESET]='\033[0m'
# Regular Colors
#COLORS[Black]='\033[0;30m' # Black
# shellcheck disable=SC2154
COLORS[Red]='\033[0;31m' # Red
# shellcheck disable=SC2154
COLORS[Green]='\033[0;32m' # Green
# shellcheck disable=SC2154
COLORS[Yellow]='\033[0;33m' # Yellow
#COLORS[Blue]='\033[0;34m' # Blue
#COLORS[Purple]='\033[0;35m' # Purple
#COLORS[Cyan]='\033[0;36m' # Cyan
# shellcheck disable=SC2154
COLORS[White]='\033[0;37m' # White
for i in "${!COLORS[@]}"; do
# shellcheck disable=SC2086
C[${i}]=$(echo -e ${COLORS[$i]})
done
# shellcheck disable=SC2034
WRN_COLOR="${C[Yellow]}"
ERR_COLOR="${C[Red]}"
STD_COLOR="${C[White]}"
OK_COLOR="${C[Green]}"
RESET="${C[RESET]}"
newVersionNumber=$(cat ../../VERSION | tr -d '\r\n')
newVersionNumber=$( tr -d '\r\n' < ../../VERSION)
declare -A ALL_GSEARCH_ID
for book in ${ALLBOOKS}; do
ALL_GSEARCH_ID[$book]=$( grep "GSEARCH_ID_${book}" ../../VERSIONS |sed 's;.*"\([0-9a-zA-Z:-]*\)".*;\1;')
done
GCHANGE_FREQ=$(grep "GCHANGE_FREQ" ../../VERSIONS |sed 's;.*"\([0-9a-zA-Z:]*\)".*;\1;')
GPRIORITY=$(grep "GPRIORITY" ../../VERSIONS |sed 's;.*"\([0-9a-zA-Z.]*\)".*;\1;')
BROWSEABLE_VERSIONS=$(grep "BROWSEABLE_VERSIONS" ../../VERSIONS |sed -e 's;" *$;;' -e 's;.*";;')
function start_X11_display()
{
PIDFILE="$1"
if test -f "${PIDFILE}"; then
stop_X11_display "${PIDFILE}"
stop_X11_display "${PIDFILE}"
fi
/usr/bin/daemon "--pidfile=${PIDFILE}" --name=xvfb --inherit --output=/tmp/xvfb.log -- Xvfb "${DISPLAY}" -screen 0 800x600x16 -ac -pn -noreset
}
@ -57,18 +73,18 @@ function check-summary()
grep -v gitbook-plugin | \
grep -v node_modules/ | \
sort > /tmp/is_md.txt
grep -v '^ *# '< "${NAME}/SUMMARY.md" | \
grep '(' |sed -e "s;.*(;;" -e "s;).*;;" | \
sort > /tmp/is_summary.txt
if test "$(comm -3 /tmp/is_md.txt /tmp/is_summary.txt|wc -l)" -ne 0; then
echo "${ERR_COLOR}"
echo "not all files are mapped to the summary!"
echo " files found | files in summary"
comm -3 /tmp/is_md.txt /tmp/is_summary.txt
echo "${RESET}"
exit 1
echo "${ERR_COLOR}"
echo "not all files are mapped to the summary!"
echo " files found | files in summary"
comm -3 /tmp/is_md.txt /tmp/is_summary.txt
echo "${RESET}"
exit 1
fi
}
@ -78,11 +94,11 @@ function book-check-leftover-docublocks()
echo "${STD_COLOR}##### checking for left over docublocks in ${NAME}${RESET}"
ERRORS=$(grep -rl "startDocuBlock" --include "*.md" "ppbooks/${NAME}" | sed -e "s/^/- /g")
if test "$(echo -n "${ERRORS}" | wc -l)" -gt 0; then
echo "${ERR_COLOR}"
echo "startDocuBlock markers still found in generated output files:"
echo "${ERR_COLOR}"
echo "startDocuBlock markers still found in generated output files:"
echo "${ERRORS}"
echo "${RESET}"
exit 1
echo "${RESET}"
exit 1
fi
}
@ -92,11 +108,11 @@ function book-check-restheader-leftovers()
echo "${STD_COLOR}##### checking for restheader leftovers in ${NAME}${RESET}"
ERRORS=$(find "ppbooks/${NAME}" -name "*.md" -exec grep -- '^@[A-Z]*' {} \; -print)
if test "$(echo -n "${ERRORS}" | wc -l)" -gt 0; then
echo "${ERR_COLOR}"
echo "found these unconverted Swagger Restapi tags: "
echo "${ERR_COLOR}"
echo "found these unconverted Swagger Restapi tags: "
echo "${ERRORS}"
echo "${RESET}"
exit 1
echo "${RESET}"
exit 1
fi
}
@ -104,12 +120,12 @@ function ppbook-precheck-bad-code-sections()
{
NAME="$1"
echo "${STD_COLOR}##### checking for bad code sections in ${NAME}${RESET}"
if grep -qR '^``` *.* ' "${NAME}"; then
echo "${ERR_COLOR}"
echo "tripple tics with blanks afterwards found: "
grep -R '^``` *.* ' "${NAME}"
echo "${RESET}"
exit 1
if grep -qR "^${TRIPPLETICS} *.* " "${NAME}"; then
echo "${ERR_COLOR}"
echo "tripple tics with blanks afterwards found: "
grep -R "^${TRIPPLETICS} *.* " "${NAME}"
echo "${RESET}"
exit 1
fi
}
@ -118,11 +134,11 @@ function ppbook-precheck-bad-headings()
NAME="$1"
echo "${STD_COLOR}##### checking for headers that won't proper display on github in ${NAME}${RESET}"
if grep -qRI '^##*[a-zA-Z]' "${NAME}"; then
echo "${ERR_COLOR}"
echo "Headlines broken on github found: "
echo "${ERR_COLOR}"
echo "Headlines broken on github found: "
grep -RI '^##*[a-zA-Z]' "${NAME}"
echo "${RESET}"
exit 1
echo "${RESET}"
exit 1
fi
}
@ -140,14 +156,14 @@ function ppbook-check-html-link()
grep -v 'header.css' | \
grep -v -f /tmp/books.regex > /tmp/relative_html_links.txt
set -e
if test "$(wc -l < /tmp/relative_html_links.txt)" -gt 0; then
echo "${ERR_COLOR}"
echo "Found links to .html files inside of the document! use <foo>.md instead!"
echo
cat /tmp/relative_html_links.txt
echo "${RESET}"
exit 1
echo "${ERR_COLOR}"
echo "Found links to .html files inside of the document! use <foo>.md instead!"
echo
cat /tmp/relative_html_links.txt
echo "${RESET}"
exit 1
fi
}
@ -168,11 +184,11 @@ function ppbook-check-directory-link()
set -e
nERRORS=$(echo -n "${ERRORS}" | wc -l)
if test "$nERRORS" -gt 0; then
echo "${ERR_COLOR}"
echo "Found director links! use ../<directory>/README.md instead!"
echo "${ERRORS}"
echo "${RESET}"
exit 1
echo "${ERR_COLOR}"
echo "Found director links! use ../<directory>/README.md instead!"
echo "${ERRORS}"
echo "${RESET}"
exit 1
fi
}
@ -183,77 +199,77 @@ function book-check-markdown-leftovers()
echo "${STD_COLOR}##### checking for remaining markdown snippets in the HTML output of ${NAME}${RESET}"
ERRORS=$(find "books/${NAME}" -name '*.html' -exec grep -- '##' {} \; -print)
if test "$(echo -n "${ERRORS}" | wc -l)" -gt 0; then
echo "${ERR_COLOR}";
echo "found these unconverted markdown titles: "
echo "${ERR_COLOR}";
echo "found these unconverted markdown titles: "
echo "${ERRORS}"
echo "${RESET}";
exit 1;
echo "${RESET}";
exit 1;
fi
set +e
ERRORS=$(find "books/${NAME}" -name '*.html' -exec grep -- '&amp;gt;' {} \; -print)
set -e
if test "$(echo -n "${ERRORS}" | wc -l)" -gt 0; then
echo "${ERR_COLOR}"
echo "found these double converted > signs: "
echo "${ERR_COLOR}"
echo "found these double converted > signs: "
echo "${ERRORS}"
echo "${RESET}"
exit 1;
echo "${RESET}"
exit 1;
fi
set +e
ERRORS=$(find "books/${NAME}" -name '*.html' -exec grep '\.md\"[ />]' {} \; | grep -v data-filepath)
set -e
if test "$(echo -n "${ERRORS}" | wc -l)" -gt 0; then
echo "${ERR_COLOR}"
echo "${ERR_COLOR}"
echo "${ERRORS}"
echo "found dangling markdown links; see the list above "
echo "${RESET}"
exit 1
echo "found dangling markdown links; see the list above "
echo "${RESET}"
exit 1
fi
set +e
ERRORS=$(find "books/${NAME}" -name '*.html' -exec grep '\.md#' {} \; -print)
set -e
if test "$(echo -n "${ERRORS}" | wc -l)" -gt 0; then
echo "${ERR_COLOR}"
echo "found dangling markdown links: "
echo "${ERR_COLOR}"
echo "found dangling markdown links: "
echo "${ERRORS}"
echo "${RESET}"
exit 1
echo "${RESET}"
exit 1
fi
set +e
ERRORS=$(find "books/${NAME}" -name '*.html' -exec grep '```' {} \; -print)
ERRORS=$(find "books/${NAME}" -name '*.html' -exec grep "${TRIPPLETICS}" {} \; -print)
set -e
if test "$(echo -n "${ERRORS}" | wc -l)" -gt 0; then
echo "${ERR_COLOR}"
echo "found dangling markdown code sections: "
echo "${ERR_COLOR}"
echo "found dangling markdown code sections: "
echo "${ERRORS}"
echo "${RESET}"
exit 1
echo "${RESET}"
exit 1
fi
set +e
ERRORS=$(find "books/${NAME}" -name '*.html' -exec grep '\]<a href' {} \; -print)
set -e
if test "$(echo -n "${ERRORS}" | wc -l)" -gt 0; then
echo "${ERR_COLOR}"
echo "found unconverted markdown links: "
echo "${ERR_COLOR}"
echo "found unconverted markdown links: "
echo "${ERRORS}"
echo "${RESET}"
exit 1
echo "${RESET}"
exit 1
fi
set +e
ERRORS=$(find "books/${NAME}" -name '*.html' -exec grep '\[.*\](.*[\.html|\.md|http|#.*])' {} \; -print)
set -e
if test "$(echo -n "${ERRORS}" | wc -l)" -gt 0; then
echo "${ERR_COLOR}"
echo "found unconverted markdown links: "
echo "${ERR_COLOR}"
echo "found unconverted markdown links: "
echo "${ERRORS}"
echo "${RESET}"
exit 1
echo "${RESET}"
exit 1
fi
}
@ -261,60 +277,61 @@ function check-dangling-anchors()
{
echo "${STD_COLOR}##### checking for dangling anchors${RESET}"
find books/ -name '*.html' | while IFS= read -r htmlf; do
fn=$(basename "${htmlf}")
dir=$(echo "$htmlf" |sed "s;/$fn;;")
mkdir -p "/tmp/tags/${dir}"
fn=$(basename "${htmlf}")
dir=$(sed "s;/$fn;;" <<< "$htmlf")
mkdir -p "/tmp/tags/${dir}"
grep '<h. ' < "${htmlf}" | \
sed -e 's;.*id=";;' -e 's;".*;;' > "/tmp/tags/${dir}/${fn}"
done
echo "${STD_COLOR}##### fetching anchors from generated http files${RESET}"
grep -R "a href.*#" books/ | \
egrep -v "(styles/header\.js|/app\.js|class=\"navigation|https*://|href=\"#\")" | \
sed 's;\(.*\.html\):.*a href="\(.*\)#\(.*\)">.*</a>.*;\1,\2,\3;' | grep -v " " > /tmp/anchorlist.txt
egrep -v "(styles/header\.js|/app\.js|class=\"navigation|https*://|href=\"#\")" | \
sed 's;\(.*\.html\):.*a href="\(.*\)#\(.*\)">.*</a>.*;\1,\2,\3;' | grep -v " " > /tmp/anchorlist.txt
echo "${STD_COLOR}##### cross checking anchors${RESET}"
NO=0
echo "${NO}" > /tmp/anchorlistcount.txt
# shellcheck disable=SC2002
cat /tmp/anchorlist.txt | while IFS= read -r i; do
ANCHOR=$(echo "$i" | cut '-d,' -f 3)
FN=$(echo "$i" | cut '-d,' -f 2)
SFN=$(echo "$i" | cut '-d,' -f 1)
if test -z "$FN"; then
FN="$SFN"
else
SFNP=$(echo "$SFN" | sed 's;/[a-zA-Z0-9]*.html;;')
FN="${SFNP}/${FN}"
fi
if test -d "$FN"; then
FN="${FN}index.html"
fi
if test -n "$ANCHOR"; then
if test ! -f "/tmp/tags/${FN}"; then
echo "${ERR_COLOR}"
echo "File referenced by ${i} doesn't exist."
NO=$((NO + 1))
echo "${RESET}"
else
ANCHOR=$(echo "$i" | cut '-d,' -f 3)
FN=$(echo "$i" | cut '-d,' -f 2)
SFN=$(echo "$i" | cut '-d,' -f 1)
if test -z "$FN"; then
FN="$SFN"
else
SFNP=$(sed 's;/[a-zA-Z0-9]*.html;;' <<< "$SFN")
FN="${SFNP}/${FN}"
fi
if test -d "$FN"; then
FN="${FN}index.html"
fi
if test -n "$ANCHOR"; then
if test ! -f "/tmp/tags/${FN}"; then
echo "${ERR_COLOR}"
echo "File referenced by ${i} doesn't exist."
NO=$((NO + 1))
echo "${RESET}"
else
if grep -q "^$ANCHOR$" "/tmp/tags/$FN"; then
true
else
echo "${ERR_COLOR}"
echo "Anchor not found in $i"
NO=$((NO + 1))
echo "${RESET}"
fi
fi
fi
true
else
echo "${ERR_COLOR}"
echo "Anchor not found in $i"
NO=$((NO + 1))
echo "${RESET}"
fi
fi
fi
echo "${NO}" > /tmp/anchorlistcount.txt
done
NO="$(cat /tmp/anchorlistcount.txt)"
if test "${NO}" -gt 0; then
echo "${ERR_COLOR}"
echo "${NO} Dangling anchors found!"
echo "${RESET}"
exit 1
echo "${ERR_COLOR}"
echo "${NO} Dangling anchors found!"
echo "${RESET}"
exit 1
fi
rm -rf /tmp/anchorlist.txt /tmp/tags
}
@ -324,13 +341,13 @@ function book-check-images-referenced()
NAME="$1"
set +e
find "${NAME}" -name \*.png | while IFS= read -r image; do
baseimage=$(basename "$image")
if ! grep -Rq "${baseimage}" "${NAME}"; then
echo "${ERR_COLOR}"
echo "$image is not used!"
echo "${RESET}"
baseimage=$(basename "$image")
if ! grep -Rq "${baseimage}" "${NAME}"; then
echo "${ERR_COLOR}"
echo "$image is not used!"
echo "${RESET}"
exit "1"
fi
fi
done
set -e
}
@ -341,9 +358,9 @@ function build-book-symlinks()
cd "books/${NAME}"
pwd
find . -name "README.md" |\
sed -e 's:README\.md$::' |\
awk '{print "ln -s index.html " "$1" "README.html"}' |\
bash
sed -e 's:README\.md$::' |\
awk '{print "ln -s index.html " "$1" "README.html"}' |\
bash
}
function build-book()
@ -354,24 +371,24 @@ function build-book()
ppbook-precheck-bad-headings "${NAME}"
if test ! -d "ppbooks/${NAME}"; then
mkdir -p "ppbooks/${NAME}"
WD=$(pwd)
mkdir -p "ppbooks/${NAME}"
WD=$(pwd)
find "${NAME}" -type d | while IFS= read -r dir; do
cd "${WD}/ppbooks"
test -d "${dir}" || mkdir -p "${dir}"
done
cd "${WD}/ppbooks"
test -d "${dir}" || mkdir -p "${dir}"
done
fi
if ditaa --help > /dev/null; then
echo "${STD_COLOR} - generating ditaa images${RESET}"
find "${NAME}" -name "*.ditaa" | while IFS= read -r image; do
ditaa "${image}" "ppbooks/${image//ditaa/png}"
done
echo "${STD_COLOR} - generating ditaa images${RESET}"
find "${NAME}" -name "*.ditaa" | while IFS= read -r image; do
ditaa "${image}" "ppbooks/${image//ditaa/png}"
done
else
echo "${ERR_COLOR} - generating FAKE ditaa images - no ditaa installed${RESET}"
find "${NAME}" -name "*.ditaa" | while IFS= read -r image; do
cp "../../js/node/node_modules/mocha/images/error.png" \
echo "${ERR_COLOR} - generating FAKE ditaa images - no ditaa installed${RESET}"
find "${NAME}" -name "*.ditaa" | while IFS= read -r image; do
cp "../../js/node/node_modules/mocha/images/error.png" \
"ppbooks/${image//ditaa/png}"
done
done
fi
echo "${STD_COLOR} - preparing environment${RESET}"
(
@ -386,15 +403,8 @@ function build-book()
cp "../../${NAME}/FOOTER.html" .
fi
)
if test -z "${RELEASE_DIRECTORY}"; then
if ! test -f "ppbooks/${NAME}/book.json" ; then
cp "${NAME}/book.json" "ppbooks/${NAME}"
fi
else
if ! test -f "ppbooks/${NAME}/book.json" ; then
sed "s;/devel;/${RELEASE_DIRECTORY};" < "${NAME}/book.json" > "ppbooks/${NAME}/book.json"
fi
fi
(
cd "ppbooks/${NAME}"
cp -a "../../${NAME}/styles/"* styles/
@ -402,8 +412,8 @@ function build-book()
WD=$(pwd)
echo "${STD_COLOR} - copying images${RESET}"
find "${NAME}" -name "*.png" | while IFS= read -r pic; do
cd "${WD}/ppbooks"
cp "${WD}/${pic}" "${pic}"
cd "${WD}/ppbooks"
cp "${WD}/${pic}" "${pic}"
done
echo "${STD_COLOR} - generating MD-Files${RESET}"
@ -412,22 +422,7 @@ function build-book()
ppbooks/ \
../../js/apps/system/_admin/aardvark/APP/api-docs.json \
"${FILTER}" || exit 1
if echo "${newVersionNumber}" | grep -q devel; then
VERSION="${newVersionNumber} $(date +' %d. %b %Y ')"
else
VERSION="${newVersionNumber}"
fi
export VERSION
echo "${STD_COLOR} - Building Version ${VERSION}${RESET}"
(
cd "ppbooks/${NAME}"
sed -i -e "s/VERSION_NUMBER/v${VERSION}/g" styles/header.js
sed -i -e "s/VERSION_NUMBER/v${VERSION}/g" HEADER.html
sed -i -e "s/VERSION_NUMBER/v${VERSION}/g" README.md
sed -i -e "s/VERSION_NUMBER/v${VERSION}/g" book.json
)
test -d "books/${NAME}" || mkdir -p "books/${NAME}"
echo "${STD_COLOR} - Checking integrity ${VERSION}${RESET}"
@ -437,22 +432,53 @@ function build-book()
ppbook-check-directory-link "${NAME}"
book-check-images-referenced "${NAME}"
if echo "${newVersionNumber}" | grep -q devel; then
VERSION="${newVersionNumber} $(date +' %d. %b %Y ')"
RELEASE_DIRECTORY=devel
else
VERSION="${newVersionNumber}"
RELEASE_DIRECTORY=$(sed "s;\.[0-9]*$;;" <<< "${newVersionNumber}")
fi
export VERSION
if ! test -f "ppbooks/${NAME}/book.json" ; then
cp "${NAME}/book.json" "ppbooks/${NAME}"
fi
for facilityfile in book.json styles/header.js HEADER.html README.md; do
export facilityfile
export RELEASE_DIRECTORY
(
cd "ppbooks/${NAME}"
sed -e "s/VERSION_NUMBER/v${VERSION}/g" \
-e "s;/devel;/${RELEASE_DIRECTORY};" \
-e "s;@GSEARCH_ID@;${ALL_GSEARCH_ID[${NAME}]};" \
-e "s;@GCHANGE_FREQ@;${GCHANGE_FREQ};" \
-e "s;@GPRIORITY@;${GPRIORITY};" \
-e "s;@BROWSEABLE_VERSIONS@;${BROWSEABLE_VERSIONS};" \
\
-i "${facilityfile}"
)
done
echo "${STD_COLOR} - Building Version ${VERSION}${RESET}"
if test -n "${NODE_MODULES_DIR}"; then
echo "${STD_COLOR}#### Installing plugins from ${NODE_MODULES_DIR}${RESET}"
cp -a "${NODE_MODULES_DIR}" "ppbooks/${NAME}"
cp -a "${NODE_MODULES_DIR}" "ppbooks/${NAME}"
else
echo "${STD_COLOR}#### Downloading plugins from ${NODE_MODULES_DIR}${RESET}"
(cd "ppbooks/${NAME}"; gitbook install -g)
(cd "ppbooks/${NAME}"; gitbook install -g)
fi
echo "${STD_COLOR} - Building Book ${NAME} ${RESET}"
(cd "ppbooks/${NAME}" && gitbook ${GITBOOK_ARGS} build "./" "./../../books/${NAME}")
(cd "ppbooks/${NAME}" && gitbook "${GITBOOK_ARGS[@]}" build "./" "./../../books/${NAME}")
rm -f "./books/${NAME}/HEADER.html"
rm -f "./books/${NAME}/FOOTER.html"
echo "${STD_COLOR} - deleting markdown files in output (gitbook 3.x bug)"
find "./books/${NAME}/" -type f -name "*.md" -delete
echo "${STD_COLOR} - putting in deprecated items ${RESET}"
python ../Scripts/deprecated.py || exit 1
book-check-markdown-leftovers "${NAME}"
}
@ -462,12 +488,12 @@ function build-book-dist()
export DISPLAY="$2"
cd "ppbooks/${NAME}"
for ext in ${OTHER_MIME}; do
OUTPUT="${OUTPUT_DIR}/ArangoDB_${NAME}_${newVersionNumber}.${ext}"
if gitbook ${GITBOOK_ARGS} "${ext}" ./ "${OUTPUT}"; then
echo "success building ${OUTPUT}"
else
exit 1
fi
OUTPUT="${OUTPUT_DIR}/ArangoDB_${NAME}_${newVersionNumber}.${ext}"
if gitbook "${GITBOOK_ARGS[@]}" "${ext}" ./ "${OUTPUT}"; then
echo "success building ${OUTPUT}"
else
exit 1
fi
done
}
@ -503,21 +529,21 @@ function clean-book-intermediate()
function check-docublocks()
{
grep -R '@startDocuBlock' --include "*.h" --include "*.cpp" --include "*.js" --include "*.md" . |\
grep -v '@startDocuBlockInline' |\
grep -v ppbook |\
grep -v allComments.txt |\
grep -v Makefile |\
grep -v '.*~:.*' |\
grep -v '.*#.*:.*' \
> /tmp/rawindoc.txt
grep -v '@startDocuBlockInline' |\
grep -v ppbook |\
grep -v allComments.txt |\
grep -v Makefile |\
grep -v '.*~:.*' |\
grep -v '.*#.*:.*' \
> /tmp/rawindoc.txt
grep -R '@startDocuBlockInline' --include "*.h" --include "*.cpp" --include "*.js" --include "*.md" . |\
grep -v ppbook |\
grep -v allComments.txt |\
grep -v Makefile |\
grep -v '.*~:.*' |\
grep -v '.*#.*:.*' \
>> /tmp/rawindoc.txt
grep -v ppbook |\
grep -v allComments.txt |\
grep -v Makefile |\
grep -v '.*~:.*' |\
grep -v '.*#.*:.*' \
>> /tmp/rawindoc.txt
sed -e "s;.*ck ;;" -e "s;.*ne ;;" < /tmp/rawindoc.txt |sort -u > /tmp/indoc.txt
@ -525,45 +551,45 @@ function check-docublocks()
grep -R '^@startDocuBlock' ../DocuBlocks --include "*.md" --include "*.md" |grep -v aardvark > /tmp/rawinprog.txt
# searching the Inline docublocks needs some more blacklisting:
grep -R '@startDocuBlockInline' --include "*.h" --include "*.cpp" --include "*.js" --include "*.md" . |\
grep -v ppbook |\
grep -v allComments.txt |\
grep -v Makefile |\
grep -v '.*~:.*' |\
grep -v '.*#.*:.*' \
>> /tmp/rawinprog.txt
grep -v ppbook |\
grep -v allComments.txt |\
grep -v Makefile |\
grep -v '.*~:.*' |\
grep -v '.*#.*:.*' \
>> /tmp/rawinprog.txt
set -e
echo "Generated: startDocuBlockInline errorCodes">> /tmp/rawinprog.txt
sed -e "s;.*ck ;;" -e "s;.*ne ;;" < /tmp/rawinprog.txt |sort > /tmp/inprog_raw.txt
sort -u < /tmp/inprog_raw.txt > /tmp/inprog.txt
if test "$(wc -l < /tmp/inprog.txt)" -ne "$(wc -l < /tmp/inprog_raw.txt)"; then
echo "${ERR_COLOR}"
echo "Duplicate entry found in the source trees:"
comm -3 /tmp/inprog_raw.txt /tmp/inprog.txt
echo "${RESET}"
exit 1
echo "${ERR_COLOR}"
echo "Duplicate entry found in the source trees:"
comm -3 /tmp/inprog_raw.txt /tmp/inprog.txt
echo "${RESET}"
exit 1
fi
if test "$(comm -3 /tmp/indoc.txt /tmp/inprog.txt |wc -l)" -ne 0; then
echo "${ERR_COLOR}"
echo "Not all blocks were found on both sides:"
echo "Documentation | Programcode:"
comm -3 /tmp/indoc.txt /tmp/inprog.txt
if test "$(comm -2 -3 /tmp/indoc.txt /tmp/inprog.txt |wc -l)" -gt 0; then
echo "Documentation: "
for grepit in $(comm -2 -3 /tmp/indoc.txt /tmp/inprog.txt); do
grep "$grepit" /tmp/rawindoc.txt
done
fi
if test "$(comm -1 -3 /tmp/indoc.txt /tmp/inprog.txt |wc -l)" -gt 0; then
echo "Program code:"
for grepit in $(comm -1 -3 /tmp/indoc.txt /tmp/inprog.txt); do
grep "$grepit" /tmp/rawinprog.txt | sed "s;/// @startDocuBlock;\t\t;"
done
fi
echo "${RESET}"
exit 1
echo "${ERR_COLOR}"
echo "Not all blocks were found on both sides:"
echo "Documentation | Programcode:"
comm -3 /tmp/indoc.txt /tmp/inprog.txt
if test "$(comm -2 -3 /tmp/indoc.txt /tmp/inprog.txt |wc -l)" -gt 0; then
echo "Documentation: "
for grepit in $(comm -2 -3 /tmp/indoc.txt /tmp/inprog.txt); do
grep "$grepit" /tmp/rawindoc.txt
done
fi
if test "$(comm -1 -3 /tmp/indoc.txt /tmp/inprog.txt |wc -l)" -gt 0; then
echo "Program code:"
for grepit in $(comm -1 -3 /tmp/indoc.txt /tmp/inprog.txt); do
grep "$grepit" /tmp/rawinprog.txt | sed "s;/// @startDocuBlock;\t\t;"
done
fi
echo "${RESET}"
exit 1
fi
}
@ -594,15 +620,15 @@ function build-books()
rm -rf /tmp/tags
set -e
for book in ${ALLBOOKS}; do
clean-intermediate "${book}"
clean-intermediate "${book}"
done
for book in ${ALLBOOKS}; do
build-book-keep-md "${book}"
build-book-keep-md "${book}"
done
for book in ${ALLBOOKS}; do
ppbook-check-html-link "${book}"
ppbook-check-html-link "${book}"
done
check-docublocks
@ -618,29 +644,29 @@ function build-dist-books()
rm -rf books ppbooks
PIDFILE=/tmp/xvfb_20_0.pid
if test -z "${DISPLAY}"; then
DISPLAY=:20.0
start_X11_display "${PIDFILE}" "${DISP}"
trap 'stop_X11_display "${PIDFILE}"' 0
DISPLAY=:20.0
start_X11_display "${PIDFILE}" "${DISP}"
trap 'stop_X11_display "${PIDFILE}"' 0
fi
export DISPLAY
WD=$(pwd)
build-books
mkdir -p "${OUTPUT_DIR}"
(
mv books "ArangoDB-${newVersionNumber}"
mv books "ArangoDB-${newVersionNumber}"
pwd
tar -czf "${OUTPUT_DIR}/ArangoDB-${newVersionNumber}.tar.gz" "ArangoDB-${newVersionNumber}"
mv "ArangoDB-${newVersionNumber}" books
tar -czf "${OUTPUT_DIR}/ArangoDB-${newVersionNumber}.tar.gz" "ArangoDB-${newVersionNumber}"
mv "ArangoDB-${newVersionNumber}" books
)
for book in $ALLBOOKS; do
cd "$WD"; build-book-dist "${book}"
cd "$WD"; build-book-dist "${book}"
done
}
function printHelp()
{
cat <<EOF
cat <<EOF
Usage: VERB arguments
Available Verbs:
build-dist-books - build all books in all representations (HTML(+tarball)/PDF/...) - takes some time.
@ -669,36 +695,36 @@ fi
while [ $# -gt 0 ]; do
case "$1" in
--name)
shift
NAME=$1
shift
;;
--filter)
shift
FILTER=$1
export FILTER
shift
;;
--outputDir)
shift
OUTPUT_DIR=$1
shift
;;
--cookBook)
shift
shift
;;
--nodeModulesDir)
shift
NODE_MODULES_DIR=$1
export NODE_MODULES_DIR
--name)
shift
;;
*)
printHelp
exit 1
;;
NAME=$1
shift
;;
--filter)
shift
FILTER=$1
export FILTER
shift
;;
--outputDir)
shift
OUTPUT_DIR=$1
shift
;;
--cookBook)
shift
shift
;;
--nodeModulesDir)
shift
NODE_MODULES_DIR=$1
export NODE_MODULES_DIR
shift
;;
*)
printHelp
exit 1
;;
esac
done
@ -706,34 +732,34 @@ done
case "$VERB" in
build-books)
build-books
;;
build-books
;;
build-book)
if test -z "$NAME"; then
echo "you need to specify the name!"
printHelp
exit 1
fi
build-book "$NAME"
;;
if test -z "$NAME"; then
echo "you need to specify the name!"
printHelp
exit 1
fi
build-book "$NAME"
;;
build-dist-books)
build-dist-books
;;
build-dist-books
;;
build-book-keep-md)
if test -z "$NAME"; then
echo "you need to specify the name!"
printHelp
exit 1
fi
build-book-keep-md "$NAME"
;;
if test -z "$NAME"; then
echo "you need to specify the name!"
printHelp
exit 1
fi
build-book-keep-md "$NAME"
;;
clean)
clean
clean "$@"
;;
*)
printHelp
exit 1
;;
printHelp
exit 1
;;
esac
echo "${OK_COLOR}Well done!${RESET}"

7
VERSIONS Normal file
View File

@ -0,0 +1,7 @@
GSEARCH_ID_HTTP "010085642145132923492:fixi4yzeiz8"
GSEARCH_ID_AQL "010085642145132923492:6ymjhhr677k"
GSEARCH_ID_Manual "010085642145132923492:djexw6vlsgo"
GSEARCH_ID_Cookbook "010085642145132923492:nknyifjn7tu"
GCHANGE_FREQ "daily"
GPRIORITY "0.3"
BROWSEABLE_VERSIONS "'devel', '3.2', '3.1', '3.0', '2.8'"