From 76af1279d9a4ab574d87e93466166b7b210c2bad Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 7 Oct 2013 01:53:18 +0200 Subject: Move test site hooks into separate file Put the code for creating the test instance into a separate hook file in order to make the other files less convoluted. --- libexec/post-receive.d/04-build-web-site | 46 +++++++++----------------------- 1 file changed, 13 insertions(+), 33 deletions(-) (limited to 'libexec/post-receive.d/04-build-web-site') 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' prefix='/home/plugins' repository=${PWD##*/} -plugins_repository='nagios-plugins.git' -web_repository='site.git' -prod_branch='master' -test_branch='test' -test_directory="$prefix/web/test" +web_repositories='nagios-plugins.git site.git' +web_branch='master' -if [ "$repository" = "$plugins_repository" ] \ - || [ "$repository" = "$web_repository" ] -then - forty_zeros=$(printf '%.40d' '0') - - while read old new ref - do - branch=${ref#refs/heads/} - - if [ "$branch" = "$prod_branch" ] - then - "$prefix/bin/build-web-site" >'/dev/null' - elif [ "$repository" = "$web_repository" ] \ - && [ "$branch" = "$test_branch" ] - then - if [ "$new" != "$forty_zeros" ] - then - "$prefix/bin/build-web-site" -t >'/dev/null' - else - rm -rf "$test_directory"/* - fi - cat >>"$test_directory/robots.txt" <<-'EOF' - User-agent: * - Disallow: / - EOF - fi - done -fi +for web_repository in $web_repositories +do + if [ "$repository" = "$web_repository" ] + then + while read old new ref + do + test "${ref#refs/heads/}" = "$web_branch" \ + && exec "$prefix/bin/build-web-site" >'/dev/null' + done + fi +done -- cgit v1.2.3-74-g34f1