diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-10-04 22:56:26 (GMT) |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-10-04 22:56:26 (GMT) |
commit | 84c4a5d24cbef536b8248a3d8ff72bb2b4248c29 (patch) | |
tree | aa5eaf24f84315ea5fa143bf287c9fcf7857391f /bin | |
parent | 45d3e695be499cf9f9956c223883073fc20d48b4 (diff) | |
download | site-84c4a5d24cbef536b8248a3d8ff72bb2b4248c29.tar.gz |
Add test instance of the web site
Serve https://www.nagios-plugins.org:444/ from the "test" branch of this
repository.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/build-web-site | 41 | ||||
-rwxr-xr-x | bin/git-export | 27 |
2 files changed, 47 insertions, 21 deletions
diff --git a/bin/build-web-site b/bin/build-web-site index 95ac355..9886b7a 100755 --- a/bin/build-web-site +++ b/bin/build-web-site | |||
@@ -16,31 +16,42 @@ set -e | |||
16 | set -u | 16 | set -u |
17 | 17 | ||
18 | prefix='/home/plugins' | 18 | prefix='/home/plugins' |
19 | poole_dir="$prefix/web/generator" | 19 | |
20 | site_source_dir="$prefix/exported/site/web/content" | 20 | export PATH="$prefix/src/poole:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin" |
21 | site_target_dir="$poole_dir/input" | 21 | |
22 | myself=${0##*/} | ||
22 | man_source_dir="$prefix/web/work/man" | 23 | man_source_dir="$prefix/web/work/man" |
23 | man_target_dir="$site_target_dir/doc/man" | ||
24 | guidelines_source="$prefix/web/work/guidelines.html" | 24 | guidelines_source="$prefix/web/work/guidelines.html" |
25 | guidelines_target="$site_target_dir/doc/guidelines.html" | 25 | site_target_dir=$(mktemp -d "/tmp/$myself.XXXXXX") |
26 | man_target_dir="$site_target_dir/input/doc/man" | ||
27 | guidelines_target="$site_target_dir/input/doc/guidelines.html" | ||
26 | 28 | ||
27 | export PATH="$prefix/src/poole:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin" | 29 | trap 'rm -rf "$site_target_dir"' EXIT |
30 | |||
31 | if [ $# -gt 0 ] && [ "$1" = '-t' ] | ||
32 | then # Build test instance. | ||
33 | site_source_dir="$prefix/exported/site-test/web" | ||
34 | output_dir="$prefix/web/test" | ||
35 | else | ||
36 | site_source_dir="$prefix/exported/site/web" | ||
37 | output_dir="$prefix/web/site" | ||
38 | fi | ||
28 | 39 | ||
29 | # | 40 | # |
30 | # Collect the pieces of the site. | 41 | # Collect the pieces of the site, and create a link to the output directory. |
31 | # | 42 | # |
32 | rsync -aH --delete "$site_source_dir/" "$site_target_dir" | 43 | rsync -aH "$site_source_dir/" "$site_target_dir" |
33 | rsync -aH "$man_source_dir/" "$man_target_dir" | 44 | rsync -aH "$man_source_dir/" "$man_target_dir" |
34 | cp -p "$guidelines_source" "$guidelines_target" | 45 | cp -p "$guidelines_source" "$guidelines_target" |
35 | 46 | ln -s "$output_dir" "$site_target_dir/output" | |
36 | cd "$poole_dir" | ||
37 | 47 | ||
38 | # | 48 | # |
39 | # See http://pythonhosted.org/Markdown/extensions/ for documentation on the | 49 | # See http://pythonhosted.org/Markdown/extensions/ for documentation on the |
40 | # extensions. | 50 | # extensions. |
41 | # | 51 | # |
42 | exec poole.py --build \ | 52 | poole.py --build \ |
43 | --md-ext='extra' \ | 53 | --md-ext='extra' \ |
44 | --md-ext='headerid' \ | 54 | --md-ext='headerid' \ |
45 | --md-ext='toc' \ | 55 | --md-ext='toc' \ |
46 | --md-ext='wikilinks' | 56 | --md-ext='wikilinks' \ |
57 | "$site_target_dir" | ||
diff --git a/bin/git-export b/bin/git-export index fc76081..06d832a 100755 --- a/bin/git-export +++ b/bin/git-export | |||
@@ -18,23 +18,38 @@ set -u | |||
18 | export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' | 18 | export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' |
19 | 19 | ||
20 | export_prefix='/home/plugins/exported' | 20 | export_prefix='/home/plugins/exported' |
21 | export_branch='master' | ||
22 | myself=${0##*/} | 21 | myself=${0##*/} |
23 | 22 | ||
24 | if [ $# -lt 1 ] | 23 | usage() |
25 | then | 24 | { |
26 | echo >&2 "Usage: $myself <repository> ..." | 25 | echo >&2 "Usage: $myself [-b <branch>] <repository> ..." |
27 | exit 2 | 26 | exit 2 |
28 | fi | 27 | } |
28 | |||
29 | while getopts b: option | ||
30 | do | ||
31 | case $option in | ||
32 | b) | ||
33 | branch=$OPTARG | ||
34 | ;; | ||
35 | *) | ||
36 | usage | ||
37 | ;; | ||
38 | esac | ||
39 | done | ||
40 | |||
41 | shift $((OPTIND - 1)) | ||
42 | test $# -ge 1 || usage | ||
29 | 43 | ||
30 | for repository in "$@" | 44 | for repository in "$@" |
31 | do | 45 | do |
32 | export_dir="$export_prefix/${repository##*/}" | 46 | export_dir="$export_prefix/${repository##*/}" |
33 | export_dir=${export_dir%.git} | 47 | export_dir=${export_dir%.git} |
48 | export_dir="$export_dir${branch:+-$branch}" | ||
34 | 49 | ||
35 | cd "$repository" | 50 | cd "$repository" |
36 | rm -r -f "$export_dir" | 51 | rm -r -f "$export_dir" |
37 | mkdir -p "$export_dir" | 52 | mkdir -p "$export_dir" |
38 | git archive "$export_branch" | tar -x -C "$export_dir" -f - | 53 | git archive "${branch:-master}" | tar -x -C "$export_dir" -f - |
39 | cd "$OLDPWD" | 54 | cd "$OLDPWD" |
40 | done | 55 | done |