# Re: [PATCH] instaweb: support for Ruby's WEBrick server

4 messages from 2007-09-17 to 2007-09-17. Participants: Eric Wong, Thomas Adam, Florian Weimer, Mike Dalessio.
Thread: https://gitlist.dev/t/9892

## Eric Wong, 2007-09-17 11:55

Subject: Re: [PATCH] instaweb: support for Ruby's WEBrick server
Message-ID: <20070917115518.GA26815@soma>
URL: https://gitlist.dev/e/20070917115518.GA26815%40soma
In-Reply-To: <618c07250709161935g333f0536q31b453bd58f2d75d@mail.gmail.com>

```
Mike Dalessio <mike@csa.net> wrote:
> 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 (short!) 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.

Nice.  I'm in favor of adding WEBrick since it's fairly commonly
installed on developer boxes and is more consistently available
if available at all.  Apache and lighttpd may not be compiled
with some modules we need.

I'm having trouble applying this patch, however.  It's
whitespace-mangled and using long lines doesn't help mailers much.

> Signed-off-by: Mike Dalessio <mike.dalessio@gmail.com>
> ---
>  Documentation/git-instaweb.txt |    3 ++-
>  git-instaweb.sh                |   29 ++++++++++++++++++++++++++++-
>  2 files changed, 30 insertions(+), 2 deletions(-)
> 
> +webrick_conf () {
> +    # generate a standalone server script in $fqgitdir/gitweb.
> +        cat > "$fqgitdir/gitweb/$httpd" <<EOF
> +#! /usr/bin/ruby

Could we make the shebang dynamic? (capturing the output of `which ruby`
maybe, or just breaking down and using /usr/bin/env ruby).  The ruby
binary seems to appear all over the place on the filesystem from my
experience, especially with its popularity amongst OSX users.

-- 
Eric Wong

```

## Thomas Adam, 2007-09-17 12:02

Subject: Re: [PATCH] instaweb: support for Ruby's WEBrick server
Message-ID: <18071eea0709170502s397331c5j7d77aa9531f73704@mail.gmail.com>
URL: https://gitlist.dev/e/18071eea0709170502s397331c5j7d77aa9531f73704%40mail.gmail.com
In-Reply-To: <20070917115518.GA26815@soma>

```
On 17/09/2007, Eric Wong <normalperson@yhbt.net> wrote:
> Could we make the shebang dynamic? (capturing the output of `which ruby`
> maybe, or just breaking down and using /usr/bin/env ruby).  The ruby
> binary seems to appear all over the place on the filesystem from my
> experience, especially with its popularity amongst OSX users.

This is what /usr/bin/env is useful for, but it's not that portable.

-- Thomas Adam

```

## Florian Weimer, 2007-09-17 12:25

Subject: Re: [PATCH] instaweb: support for Ruby's WEBrick server
Message-ID: <823axd32dz.fsf@mid.bfk.de>
URL: https://gitlist.dev/e/823axd32dz.fsf%40mid.bfk.de
In-Reply-To: <18071eea0709170502s397331c5j7d77aa9531f73704@mail.gmail.com>

```
* Thomas Adam:

> This is what /usr/bin/env is useful for, but it's not that portable.

Yeah, it's /bin/env exclusively on some systems. 8-(

-- 
Florian Weimer                <fweimer@bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99

```

## Mike Dalessio, 2007-09-17 13:55

Subject: Re: [PATCH] instaweb: support for Ruby's WEBrick server
Message-ID: <618c07250709170655p649a71fdwcfaaa4d5bfcd06ff@mail.gmail.com>
URL: https://gitlist.dev/e/618c07250709170655p649a71fdwcfaaa4d5bfcd06ff%40mail.gmail.com
In-Reply-To: <823axd32dz.fsf@mid.bfk.de>

```
I could generate a second /bin/sh script to run
  "ruby .../webrick.rb"
This would assume that 'ruby' was in the user's $PATH, but that seems
like a reasonable expectation.

The drawback is that we'd be generating TWO scripts, one ruby script
to invoke the server, and one shell script to run the ruby
script. This seems a little ... circuitous.

Another idea is to hack the $httpd variable to contain a command
string like "ruby .../webrick.rb", with the drawback then being a lack
of obviousness, since the convention is that the variable contains the
same command as the --httpd argument, and is named the same as
the <webserver>_conf() functions.

On 9/17/07, Florian Weimer <fweimer@bfk.de> wrote:
> * Thomas Adam:
>
> > This is what /usr/bin/env is useful for, but it's not that portable.
>
> Yeah, it's /bin/env exclusively on some systems. 8-(
>
> --
> Florian Weimer                <fweimer@bfk.de>
> BFK edv-consulting GmbH       http://www.bfk.de/
> Kriegsstraße 100              tel: +49-721-96201-1
> D-76133 Karlsruhe             fax: +49-721-96201-99
>


-- 
mike dalessio
mike@csa.net

```
