diff options
| author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-10-05 00:56:26 +0200 |
|---|---|---|
| committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-10-05 00:56:26 +0200 |
| commit | 84c4a5d24cbef536b8248a3d8ff72bb2b4248c29 (patch) | |
| tree | aa5eaf24f84315ea5fa143bf287c9fcf7857391f /libexec | |
| 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 'libexec')
| -rwxr-xr-x | libexec/post-receive.d/01-git-export | 22 | ||||
| -rwxr-xr-x | libexec/post-receive.d/04-build-web-site | 46 |
2 files changed, 55 insertions, 13 deletions
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 | ||
| 20 | prefix='/home/plugins' | 20 | prefix='/home/plugins' |
| 21 | 21 | ||
| 22 | # | ||
| 23 | # Check whether the "test" branch of the "site.git" repository has been updated. | ||
| 24 | # | ||
| 25 | if [ "${PWD##*/}" = 'site.git' ] | ||
| 26 | then | ||
| 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 | ||
| 42 | fi | ||
| 43 | |||
| 22 | exec "$prefix/bin/git-export" "$PWD" | 44 | exec "$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 | ||
| 20 | prefix='/home/plugins' | 20 | prefix='/home/plugins' |
| 21 | repository=${PWD##*/} | 21 | repository=${PWD##*/} |
| 22 | web_repositories='nagios-plugins.git site.git' | 22 | plugins_repository='nagios-plugins.git' |
| 23 | web_branch='master' | 23 | web_repository='site.git' |
| 24 | prod_branch='master' | ||
| 25 | test_branch='test' | ||
| 26 | test_directory="$prefix/web/test" | ||
| 24 | 27 | ||
| 25 | for web_repository in $web_repositories | 28 | if [ "$repository" = "$plugins_repository" ] \ |
| 26 | do | 29 | || [ "$repository" = "$web_repository" ] |
| 27 | if [ "$repository" = "$web_repository" ] | 30 | then |
| 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" ] |
| 35 | done | 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 | ||
| 55 | fi | ||
