Filed under git, programming, ruby by Scott | 2 comments
I’ve been working on getting as much as possible of my Ruby/Git library to run in pure ruby rather than forking out to the git binary, and luckily the guys that started the gitrb project some time ago let me incorporate their code into mine. Now I have quite a bit of my gitweb camping app running without calling ‘git’ at all. Only the archive and diff methods are currently invoked - everything else is in pure ruby.
The other cool thing I get from this that I’ve done a simple command line client that does a number of git functions without needing git compiled on the machine at all:
$ gitr log
$ gitr branches
$ gitr ls-tree (sha)
$ gitr cat-file (sha)
$ gitr rev-parse v1.0.2
All of those are run without forking out to the git binary. Sweet. You can get this code at my Repo.or.cz Ruby/Git repo. I will release it as a new gem soon.
Filed under git, programming, ruby by Scott | 1 comment
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.

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.
Filed under programming, ruby by Scott | 0 comments
I just finished somewhat in-depth screencast on using Git to manage and deploy Ruby on Rails applications. If you’re interested, you can find it here:
http://jointheconversation.org/railsgit
Scott