diff options
Diffstat (limited to 'libexec/post-receive.d/04-build-web-site')
| -rwxr-xr-x | libexec/post-receive.d/04-build-web-site | 46 | 
1 files changed, 13 insertions, 33 deletions
diff --git a/libexec/post-receive.d/04-build-web-site b/libexec/post-receive.d/04-build-web-site index 6338968..7c178cf 100755 --- a/libexec/post-receive.d/04-build-web-site +++ b/libexec/post-receive.d/04-build-web-site  | |||
| @@ -19,37 +19,17 @@ 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 | plugins_repository='nagios-plugins.git' | 22 | web_repositories='nagios-plugins.git site.git' | 
| 23 | web_repository='site.git' | 23 | web_branch='master' | 
| 24 | prod_branch='master' | ||
| 25 | test_branch='test' | ||
| 26 | test_directory="$prefix/web/test" | ||
| 27 | 24 | ||
| 28 | if [ "$repository" = "$plugins_repository" ] \ | 25 | for web_repository in $web_repositories | 
| 29 | || [ "$repository" = "$web_repository" ] | 26 | do | 
| 30 | then | 27 | if [ "$repository" = "$web_repository" ] | 
| 31 | forty_zeros=$(printf '%.40d' '0') | 28 | then | 
| 32 | 29 | while read old new ref | |
| 33 | while read old new ref | 30 | do | 
| 34 | do | 31 | test "${ref#refs/heads/}" = "$web_branch" \ | 
| 35 | branch=${ref#refs/heads/} | 32 | && exec "$prefix/bin/build-web-site" >'/dev/null' | 
| 36 | 33 | done | |
| 37 | if [ "$branch" = "$prod_branch" ] | 34 | fi | 
| 38 | then | 35 | done | 
| 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 | ||
