website-doc.sh: include user contributions

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2015-03-25 20:09:59 +01:00
parent 1708fd09d1
commit aec5430457
4 changed files with 53 additions and 29 deletions

View File

@ -93,12 +93,8 @@ function edit_file () {
function fix_pwd () { function fix_pwd () {
debug 'in fix_pwd' debug 'in fix_pwd'
if test ! -d .git -a ! -f offlineimap.py cd "$(git rev-parse --show-toplevel)" || \
then die 2 "cannot determine the root of the repository"
test "$PWD" = '/' && die 2 "You're not in the offlineimap repository..."
cd ..
fix_pwd
fi
} }

View File

@ -1,16 +1,17 @@
Systemd units ---
============= layout: page
title: Integrating OfflineIMAP into systemd
author: Ben Boeckel
date: 2015-03-22
---
These unit files are meant to be used in the user session. You may drop them <!-- This file is copied to the website by script. -->
into `${XDG_DATA_HOME}/systemd/user` followed by `systemctl --user
daemon-reload` to have systemd aware of the unit files.
These files are meant to be triggered either manually using `systemctl --user
start offlineimap.service` or by enabling the timer unit using `systemctl
--user enable offlineimap.timer`. Additionally, specific accounts may be
triggered by using `offlineimap@myaccount.timer` or
`offlineimap@myaccount.service`.
These unit files are installed as being enabled via a `mail.target` unit which ## Systemd units
is intended to be a catch-all for mail-related unit files. A simple
`mail.target` file is also provided. These unit files are meant to be used in the user session. You may drop them into `${XDG_DATA_HOME}/systemd/user` followed by `systemctl --user daemon-reload` to have systemd aware of the unit files.
These files are meant to be triggered either manually using `systemctl --user start offlineimap.service` or by enabling the timer unit using `systemctl --user enable offlineimap.timer`. Additionally, specific accounts may be triggered by using `offlineimap@myaccount.timer` or `offlineimap@myaccount.service`.
These unit files are installed as being enabled via a `mail.target` unit which is intended to be a catch-all for mail-related unit files. A simple `mail.target` file is also provided.

View File

@ -30,6 +30,7 @@ api:
websitedoc: websitedoc:
./website-doc.sh releases ./website-doc.sh releases
./website-doc.sh api ./website-doc.sh api
./website-doc.sh contrib
clean: clean:
$(RM) -f $(HTML_TARGETS) $(RM) -f $(HTML_TARGETS)

View File

@ -6,15 +6,38 @@ ARGS=$*
SPHINXBUILD=sphinx-build SPHINXBUILD=sphinx-build
TMPDIR='/tmp/offlineimap-sphinx-doctrees' TMPDIR='/tmp/offlineimap-sphinx-doctrees'
WEBSITE='../website' WEBSITE='./website'
DOCBASE="${WEBSITE}/_doc" DOCBASE="${WEBSITE}/_doc"
DESTBASE="${DOCBASE}/versions" DESTBASE="${DOCBASE}/versions"
VERSIONS_YML="${WEBSITE}/_data/versions.yml" VERSIONS_YML="${WEBSITE}/_data/versions.yml"
ANNOUNCES_YML="${WEBSITE}/_data/announces.yml" ANNOUNCES_YML="${WEBSITE}/_data/announces.yml"
CONTRIB_YML="${WEBSITE}/_data/contribs.yml"
CONTRIB="${DOCBASE}/contrib"
HEADER="# DO NOT EDIT MANUALLY: it is generated by a script (website-doc.sh)."
function fix_pwd () {
cd "$(git rev-parse --show-toplevel)" || \
exit 2 "cannot determine the root of the repository"
test -d "$DESTBASE" || exit 1
}
fix_pwd
version="v$(./offlineimap.py --version)"
#
# Add the doc for the contrib files.
#
function contrib () {
echo $HEADER > "$CONTRIB_YML"
# systemd
cp -afv "./contrib/systemd/README.md" "${CONTRIB}/systemd.md"
echo "- {filename: 'systemd', linkname: 'Integrate with systemd'}" >> "$CONTRIB_YML"
}
version="v$(../offlineimap.py --version)"
test -d "$DESTBASE" || exit 1
# #
# Build the sphinx documentation. # Build the sphinx documentation.
@ -24,13 +47,13 @@ function api () {
dest="${DESTBASE}/${version}" dest="${DESTBASE}/${version}"
echo "Cleaning target directory: $dest" echo "Cleaning target directory: $dest"
rm -rf "$dest" rm -rf "$dest"
$SPHINXBUILD -b html -d "$TMPDIR" doc-src "$dest" $SPHINXBUILD -b html -d "$TMPDIR" ./docs/doc-src "$dest"
# Build the JSON definitions for Jekyll. # Build the JSON definitions for Jekyll.
# This let know the website about the available APIs documentations. # This let know the website about the available APIs documentations.
echo "Building Jekyll data: $VERSIONS_YML" echo "Building Jekyll data: $VERSIONS_YML"
# Erase previous content. # Erase previous content.
echo "# DO NOT EDIT MANUALLY: it is generated by a script (website-doc.sh)" > "$VERSIONS_YML" echo "$HEADER" > "$VERSIONS_YML"
for version in $(ls "$DESTBASE" -1 | sort -nr) for version in $(ls "$DESTBASE" -1 | sort -nr)
do do
echo "- $version" echo "- $version"
@ -44,7 +67,7 @@ function api () {
# #
function releases () { function releases () {
# Copy the Changelogs. # Copy the Changelogs.
for foo in ../Changelog.md ../Changelog.maint.md for foo in ./Changelog.md ./Changelog.maint.md
do do
cp -afv "$foo" "$DOCBASE" cp -afv "$foo" "$DOCBASE"
done done
@ -52,8 +75,8 @@ function releases () {
# Build the announces JSON list. Format is JSON: # Build the announces JSON list. Format is JSON:
# - {version: '<version>', link: '<link>'} # - {version: '<version>', link: '<link>'}
# - ... # - ...
echo "# DO NOT EDIT MANUALLY: it is generated by a script (website-doc.sh)" > "$ANNOUNCES_YML" echo "$HEADER" > "$ANNOUNCES_YML"
grep -E '^### OfflineIMAP' ../Changelog.md | while read title grep -E '^### OfflineIMAP' ./Changelog.md | while read title
do do
link="$(echo $title | sed -r -e 's,^### (OfflineIMAP.*)\),\1,' \ link="$(echo $title | sed -r -e 's,^### (OfflineIMAP.*)\),\1,' \
| tr '[:upper:]' '[:lower:]' \ | tr '[:upper:]' '[:lower:]' \
@ -68,11 +91,11 @@ function releases () {
} }
exit_code=0 exit_code=0
test "n$ARGS" = 'n' && ARG='usage' # no option passed test "n$ARGS" = 'n' && ARG='usage' # no option passed
for arg in $ARGS for arg in $ARGS
do do
# PWD was fixed at the very beginning.
case "n$arg" in case "n$arg" in
"nreleases") "nreleases")
releases releases
@ -80,8 +103,11 @@ do
"napi") "napi")
api api
;; ;;
"ncontrib")
contrib
;;
"nusage") "nusage")
echo "Usage: website-doc.sh <releases|api|usage>" echo "Usage: website-doc.sh <releases|api|contrib|usage>"
;; ;;
*) *)
echo "unkown option $arg" echo "unkown option $arg"