19 Nov 2007

Ruby/Git and gitweb.rb

Lately I've been working a lot on Ruby/Git, which is a library for using Git in Ruby. It's now about at the point that I can integrate it into the stuff I'm doing at my work (we were doing some rather advanced read-tree/write-tree stuff), but I wanted another target for it so I can see first hand how the library works on real-world situations.
So, in the last two days I wrote gitweb.rb, which is a Camping app, weighing in at just 365 lines of ruby code for the whole thing. (Though, it's not really a tiny file, since I embedded code from the SHJS project for syntax highlighting, which is cool but not tiny.)
It provides a similar interface onto a Git repo as the perl version of gitweb, which is bundled with git itself. It uses my Ruby/Git bindings to do everything and it was a great test for me. My next Ruby/Git deal will be to reimplement some of the core stuff in either pure ruby or RubyInline or C bindings - my goal will be to get gitweb.rb to be able to run without the git binary present at all - no system calls forked.
Anyhow, here is what it looks like.
gitweb.rb interface


You can download it here, and run it like this:
> gem install camping git
> camping rubyweb.rb
Then point it to your repositories, and you're good.
blog comments powered by Disqus