From: mike dalessio Date: Tue, 18 Sep 2007 12:16:34 GMT Subject: [PATCH] instaweb: added support Ruby's WEBrick server Message-ID: <20070918121634.E8EFF814635@cyrano> running the webrick server with git requires Ruby and Ruby's YAML and Webrick libraries (both of which come standard with Ruby). nice for single-user standalone invocations. the --httpd=webrick option generates a ruby script on the fly to read httpd.conf options and invoke the web server via library call. this script is placed in the .git/gitweb directory. it also generates a shell script in a feeble attempt to invoke ruby in a portable manner, which assumes that 'ruby' is in the user's $PATH. Signed-off-by: Mike Dalessio --- Documentation/git-instaweb.txt | 3 +- git-instaweb.sh | 44 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/Documentation/git-instaweb.txt b/Documentation/git-instaweb.txt index cec60ee..914fc4c 100644 --- a/Documentation/git-instaweb.txt +++ b/Documentation/git-instaweb.txt @@ -27,7 +27,8 @@ OPTIONS The HTTP daemon command-line that will be executed. Command-line options may be specified here, and the configuration file will be added at the end of the command-line. - Currently, lighttpd and apache2 are the only supported servers. + Currently, lighttpd, apache2 and webrick are the only supported + servers. (Default: lighttpd) -m|--module-path:: diff --git a/git-instaweb.sh b/git-instaweb.sh index b79c6b6..803a754 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -37,7 +37,9 @@ start_httpd () { else # many httpds are installed in /usr/sbin or /usr/local/sbin # these days and those are not in most users $PATHs - for i in /usr/local/sbin /usr/sbin + # in addition, we may have generated a server script + # in $fqgitdir/gitweb. + for i in /usr/local/sbin /usr/sbin $fqgitdir/gitweb do if test -x "$i/$httpd_only" then @@ -137,6 +139,43 @@ GIT_DIR="$fqgitdir" export GIT_EXEC_PATH GIT_DIR +webrick_conf () { + # generate a standalone server script in $fqgitdir/gitweb. + cat > "$fqgitdir/gitweb/$httpd.rb" < "$fqgitdir/gitweb/$httpd" < "$conf" <> "$conf" +} + lighttpd_conf () { cat > "$conf" <