Code

git-instaweb: Extract configuring web server into configure_httpd
authorJakub Narebski <jnareb@gmail.com>
Thu, 23 Jun 2011 19:55:00 +0000 (21:55 +0200)
committerEric Wong <normalperson@yhbt.net>
Mon, 27 Jun 2011 09:11:41 +0000 (09:11 +0000)
This is preparatory work for making start/restart check that
git-instaweb set up correct configuration, and generate it if it is
missing.

Pure refactoring, no functional changes.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
git-instaweb.sh

index 8bfa8a055ccd0c344d595f112b571bb3d6e21c28..49bab7bc974f5feceb1e0806ce8d442fb14ac8fd 100755 (executable)
@@ -587,32 +587,36 @@ our \$projects_list = \$projectroot;
 EOF
 }
 
+configure_httpd() {
+       case "$httpd" in
+       *lighttpd*)
+               lighttpd_conf
+               ;;
+       *apache2*|*httpd*)
+               apache2_conf
+               ;;
+       webrick)
+               webrick_conf
+               ;;
+       *mongoose*)
+               mongoose_conf
+               ;;
+       *plackup*)
+               plackup_conf
+               ;;
+       *)
+               echo "Unknown httpd specified: $httpd"
+               exit 1
+               ;;
+       esac
+}
+
 gitweb_conf
 
 resolve_full_httpd
 mkdir -p "$fqgitdir/gitweb/$httpd_only"
 
-case "$httpd" in
-*lighttpd*)
-       lighttpd_conf
-       ;;
-*apache2*|*httpd*)
-       apache2_conf
-       ;;
-webrick)
-       webrick_conf
-       ;;
-*mongoose*)
-       mongoose_conf
-       ;;
-*plackup*)
-       plackup_conf
-       ;;
-*)
-       echo "Unknown httpd specified: $httpd"
-       exit 1
-       ;;
-esac
+configure_httpd
 
 start_httpd
 url=http://127.0.0.1:$port