threads / patch / 9892

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

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

## tl;dr

4 messages between Sep 17, 2007 and Sep 17, 2007. Diffs are folded; open one to read it.

replies: 3people: 4as markdown or json

Eric Wong· Sep 17, 2007, 11:55 UTC · lore
Mike Dalessio <mike@csa.net> wrote:
Show 7 quoted lines
> 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.

Show 10 quoted lines
> 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· Sep 17, 2007, 12:02 UTC · re: Eric Wong · lore
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· Sep 17, 2007, 12:25 UTC · re: Thomas Adam · lore
* 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· Sep 17, 2007, 13:55 UTC · re: Florian Weimer · lore
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:
Show 12 quoted lines
> * 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

← back to recent threads