Monday, May 5, 2008

Re: RSS Feeds for Subversion

I was reading a friend's blog post about RSS feeds for Subversion repositories earlier... he couldn't find anything that was not written in a scripting language which he has no access to in his environment... he needed a Java based solution. He solved his problem with a war. I came back to this after dinner (and a few glasses of wine) and decided to show him another way to solve this problem on the JVM... (you knew it was coming Matt.)

Assuming you already have JRuby setup (of course you do), we'll do the following to get the one gem we'll need:[sourcecode language="css"]> jruby -S gem install rscm[/sourcecode]

The RSCM (Ruby Source Code Management) gem provides a nice interface to SVN, CVS, ClearCase, StarTeam, etc. and since it's written in pure Ruby, it runs just fine on the JVM.

Then download this file. Not much to it, 106 lines and 45 of that is the template for creating the rss xml doc.

Command line has a few options, here's an example:[sourcecode language="css"]> jruby -J-server server.rb -p 8080 -m svnlogor just get help> jruby server --help

-p, --port=3003 Which port do you want the server to listen on.-m, --mount-point=svnrss http:///-h, --help Show help (this).[/sourcecode]

Hudson's RSS feeds are for builds, not change logs. If you keep things in your repository (like artwork repositories, or things like that) that don't trigger a build, you won't get notified that way. Additionally, you won't get a notification for each checkin, you'll get a notification for each build. Depending on the frequency of your SCM polling in Hudson you will potentially get one build for multiple checkins. Additionally, if your build is time-scheduled rather than check-in scheduled, it won't really keep you informed about checkins so much as keeping you informed about builds.

Admittedly, this is splitting hairs. In the majority of cases, knowing what built and what went into it is what you want, and Hudson's RSS feeds are great for this.

But if you need to truly monitor activity in the repository for audit reasons or to help document what problem employees have been doing, Hudson's RSS feeds don't really cut it.