summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2013-10-04 22:56:26 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2013-10-04 22:56:26 (GMT)
commit84c4a5d24cbef536b8248a3d8ff72bb2b4248c29 (patch)
treeaa5eaf24f84315ea5fa143bf287c9fcf7857391f
parent45d3e695be499cf9f9956c223883073fc20d48b4 (diff)
downloadsite-84c4a5d24cbef536b8248a3d8ff72bb2b4248c29.tar.gz
Add test instance of the web site
Serve https://www.nagios-plugins.org:444/ from the "test" branch of this repository.
-rwxr-xr-xbin/build-web-site41
-rwxr-xr-xbin/git-export27
-rw-r--r--etc/nginx/site.conf9
-rwxr-xr-xlibexec/post-receive.d/01-git-export22
-rwxr-xr-xlibexec/post-receive.d/04-build-web-site46
-rw-r--r--web/input/development.md (renamed from web/content/development.md)0
-rw-r--r--web/input/doc/extra-opts.md (renamed from web/content/doc/extra-opts.md)0
-rw-r--r--web/input/doc/faq/index.md (renamed from web/content/doc/faq/index.md)0
-rw-r--r--web/input/doc/index.md (renamed from web/content/doc/index.md)0
-rw-r--r--web/input/doc/man/index.md (renamed from web/content/doc/man/index.md)0
l---------web/input/doc/news.txt (renamed from web/content/doc/news.txt)0
-rw-r--r--web/input/doc/presentation.md (renamed from web/content/doc/presentation.md)0
-rw-r--r--web/input/doc/release-notes/1-5.md (renamed from web/content/doc/release-notes/1-5.md)0
-rw-r--r--web/input/download.md (renamed from web/content/download.md)0
-rw-r--r--web/input/impressum.md (renamed from web/content/impressum.md)0
-rw-r--r--web/input/index.md (renamed from web/content/index.md)0
-rw-r--r--web/input/media/favicon.ico (renamed from web/content/media/favicon.ico)bin4286 -> 4286 bytes
-rw-r--r--web/input/media/github.png (renamed from web/content/media/github.png)bin7927 -> 7927 bytes
-rw-r--r--web/input/media/plugins.css (renamed from web/content/media/plugins.css)0
-rw-r--r--web/input/support.md (renamed from web/content/support.md)0
-rw-r--r--web/input/team.md (renamed from web/content/team.md)0
-rw-r--r--web/input/tests.md (renamed from web/content/tests.md)0
22 files changed, 110 insertions, 35 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
16set -u 16set -u
17 17
18prefix='/home/plugins' 18prefix='/home/plugins'
19poole_dir="$prefix/web/generator" 19
20site_source_dir="$prefix/exported/site/web/content" 20export PATH="$prefix/src/poole:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin"
21site_target_dir="$poole_dir/input" 21
22myself=${0##*/}
22man_source_dir="$prefix/web/work/man" 23man_source_dir="$prefix/web/work/man"
23man_target_dir="$site_target_dir/doc/man"
24guidelines_source="$prefix/web/work/guidelines.html" 24guidelines_source="$prefix/web/work/guidelines.html"
25guidelines_target="$site_target_dir/doc/guidelines.html" 25site_target_dir=$(mktemp -d "/tmp/$myself.XXXXXX")
26man_target_dir="$site_target_dir/input/doc/man"
27guidelines_target="$site_target_dir/input/doc/guidelines.html"
26 28
27export PATH="$prefix/src/poole:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin" 29trap 'rm -rf "$site_target_dir"' EXIT
30
31if [ $# -gt 0 ] && [ "$1" = '-t' ]
32then # Build test instance.
33 site_source_dir="$prefix/exported/site-test/web"
34 output_dir="$prefix/web/test"
35else
36 site_source_dir="$prefix/exported/site/web"
37 output_dir="$prefix/web/site"
38fi
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#
32rsync -aH --delete "$site_source_dir/" "$site_target_dir" 43rsync -aH "$site_source_dir/" "$site_target_dir"
33rsync -aH "$man_source_dir/" "$man_target_dir" 44rsync -aH "$man_source_dir/" "$man_target_dir"
34cp -p "$guidelines_source" "$guidelines_target" 45cp -p "$guidelines_source" "$guidelines_target"
35 46ln -s "$output_dir" "$site_target_dir/output"
36cd "$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#
42exec poole.py --build \ 52poole.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
18export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' 18export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin'
19 19
20export_prefix='/home/plugins/exported' 20export_prefix='/home/plugins/exported'
21export_branch='master'
22myself=${0##*/} 21myself=${0##*/}
23 22
24if [ $# -lt 1 ] 23usage()
25then 24{
26 echo >&2 "Usage: $myself <repository> ..." 25 echo >&2 "Usage: $myself [-b <branch>] <repository> ..."
27 exit 2 26 exit 2
28fi 27}
28
29while getopts b: option
30do
31 case $option in
32 b)
33 branch=$OPTARG
34 ;;
35 *)
36 usage
37 ;;
38 esac
39done
40
41shift $((OPTIND - 1))
42test $# -ge 1 || usage
29 43
30for repository in "$@" 44for repository in "$@"
31do 45do
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"
40done 55done
diff --git a/etc/nginx/site.conf b/etc/nginx/site.conf
index 432c051..9105591 100644
--- a/etc/nginx/site.conf
+++ b/etc/nginx/site.conf
@@ -14,8 +14,9 @@
14# 14#
15server { 15server {
16 listen 443 ssl; 16 listen 443 ssl;
17 listen 444 ssl;
17 server_name www.nagios-plugins.org; 18 server_name www.nagios-plugins.org;
18 root /home/plugins/web/site; 19 root /home/plugins/web/port-$server_port;
19 20
20 # 21 #
21 # Downloads and attachments. 22 # Downloads and attachments.
@@ -71,9 +72,15 @@ server {
71 72
72# 73#
73# Redirect HTTP and all other domains to <https://www.nagios-plugins.org/>. 74# Redirect HTTP and all other domains to <https://www.nagios-plugins.org/>.
75# Ditto for the test instance.
74# 76#
75server { 77server {
76 listen 80 default_server; 78 listen 80 default_server;
77 listen 443 default_server ssl; 79 listen 443 default_server ssl;
78 return 301 https://www.nagios-plugins.org$request_uri; 80 return 301 https://www.nagios-plugins.org$request_uri;
79} 81}
82server {
83 listen 81 default_server;
84 listen 444 default_server ssl;
85 return 301 https://www.nagios-plugins.org:444$request_uri;
86}
diff --git a/libexec/post-receive.d/01-git-export b/libexec/post-receive.d/01-git-export
index 37994e2..171f05f 100755
--- a/libexec/post-receive.d/01-git-export
+++ b/libexec/post-receive.d/01-git-export
@@ -19,4 +19,26 @@ export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin'
19 19
20prefix='/home/plugins' 20prefix='/home/plugins'
21 21
22#
23# Check whether the "test" branch of the "site.git" repository has been updated.
24#
25if [ "${PWD##*/}" = 'site.git' ]
26then
27 forty_zeros=$(printf '%.40d' '0')
28
29 while read old new ref
30 do
31 if [ "$ref" = 'refs/heads/test' ]
32 then
33 if [ "$new" != "$forty_zeros" ]
34 then
35 "$prefix/bin/git-export" -b 'test' "$PWD"
36 else
37 rm -rf "$prefix/exported/site-test"
38 fi
39 break
40 fi
41 done
42fi
43
22exec "$prefix/bin/git-export" "$PWD" 44exec "$prefix/bin/git-export" "$PWD"
diff --git a/libexec/post-receive.d/04-build-web-site b/libexec/post-receive.d/04-build-web-site
index 7c178cf..6338968 100755
--- a/libexec/post-receive.d/04-build-web-site
+++ b/libexec/post-receive.d/04-build-web-site
@@ -19,17 +19,37 @@ export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin'
19 19
20prefix='/home/plugins' 20prefix='/home/plugins'
21repository=${PWD##*/} 21repository=${PWD##*/}
22web_repositories='nagios-plugins.git site.git' 22plugins_repository='nagios-plugins.git'
23web_branch='master' 23web_repository='site.git'
24prod_branch='master'
25test_branch='test'
26test_directory="$prefix/web/test"
24 27
25for web_repository in $web_repositories 28if [ "$repository" = "$plugins_repository" ] \
26do 29 || [ "$repository" = "$web_repository" ]
27 if [ "$repository" = "$web_repository" ] 30then
28 then 31 forty_zeros=$(printf '%.40d' '0')
29 while read old new ref 32
30 do 33 while read old new ref
31 test "${ref#refs/heads/}" = "$web_branch" \ 34 do
32 && exec "$prefix/bin/build-web-site" >'/dev/null' 35 branch=${ref#refs/heads/}
33 done 36
34 fi 37 if [ "$branch" = "$prod_branch" ]
35done 38 then
39 "$prefix/bin/build-web-site" >'/dev/null'
40 elif [ "$repository" = "$web_repository" ] \
41 && [ "$branch" = "$test_branch" ]
42 then
43 if [ "$new" != "$forty_zeros" ]
44 then
45 "$prefix/bin/build-web-site" -t >'/dev/null'
46 else
47 rm -rf "$test_directory"/*
48 fi
49 cat >>"$test_directory/robots.txt" <<-'EOF'
50 User-agent: *
51 Disallow: /
52 EOF
53 fi
54 done
55fi
diff --git a/web/content/development.md b/web/input/development.md
index ddff634..ddff634 100644
--- a/web/content/development.md
+++ b/web/input/development.md
diff --git a/web/content/doc/extra-opts.md b/web/input/doc/extra-opts.md
index 542c199..542c199 100644
--- a/web/content/doc/extra-opts.md
+++ b/web/input/doc/extra-opts.md
diff --git a/web/content/doc/faq/index.md b/web/input/doc/faq/index.md
index 18584f2..18584f2 100644
--- a/web/content/doc/faq/index.md
+++ b/web/input/doc/faq/index.md
diff --git a/web/content/doc/index.md b/web/input/doc/index.md
index 7b2d098..7b2d098 100644
--- a/web/content/doc/index.md
+++ b/web/input/doc/index.md
diff --git a/web/content/doc/man/index.md b/web/input/doc/man/index.md
index d3c60c8..d3c60c8 100644
--- a/web/content/doc/man/index.md
+++ b/web/input/doc/man/index.md
diff --git a/web/content/doc/news.txt b/web/input/doc/news.txt
index f5208d5..f5208d5 120000
--- a/web/content/doc/news.txt
+++ b/web/input/doc/news.txt
diff --git a/web/content/doc/presentation.md b/web/input/doc/presentation.md
index 458b101..458b101 100644
--- a/web/content/doc/presentation.md
+++ b/web/input/doc/presentation.md
diff --git a/web/content/doc/release-notes/1-5.md b/web/input/doc/release-notes/1-5.md
index b8f3457..b8f3457 100644
--- a/web/content/doc/release-notes/1-5.md
+++ b/web/input/doc/release-notes/1-5.md
diff --git a/web/content/download.md b/web/input/download.md
index 4d46cf5..4d46cf5 100644
--- a/web/content/download.md
+++ b/web/input/download.md
diff --git a/web/content/impressum.md b/web/input/impressum.md
index 1fba23b..1fba23b 100644
--- a/web/content/impressum.md
+++ b/web/input/impressum.md
diff --git a/web/content/index.md b/web/input/index.md
index 8ab186c..8ab186c 100644
--- a/web/content/index.md
+++ b/web/input/index.md
diff --git a/web/content/media/favicon.ico b/web/input/media/favicon.ico
index 76ae569..76ae569 100644
--- a/web/content/media/favicon.ico
+++ b/web/input/media/favicon.ico
Binary files differ
diff --git a/web/content/media/github.png b/web/input/media/github.png
index 1e19c21..1e19c21 100644
--- a/web/content/media/github.png
+++ b/web/input/media/github.png
Binary files differ
diff --git a/web/content/media/plugins.css b/web/input/media/plugins.css
index 552284f..552284f 100644
--- a/web/content/media/plugins.css
+++ b/web/input/media/plugins.css
diff --git a/web/content/support.md b/web/input/support.md
index c6d8b3d..c6d8b3d 100644
--- a/web/content/support.md
+++ b/web/input/support.md
diff --git a/web/content/team.md b/web/input/team.md
index f9b0a5d..f9b0a5d 100644
--- a/web/content/team.md
+++ b/web/input/team.md
diff --git a/web/content/tests.md b/web/input/tests.md
index bad78a9..bad78a9 100644
--- a/web/content/tests.md
+++ b/web/input/tests.md