Litespeed - Browsing subversion repositories

Litespeed does not support browsing subversion repositories in the way that the Apache webserver does.

This does not leave us high and dry though as there are plenty of third party products that allow us to browse the repository quite happily whilst using svnserve to check-out and commit any changes.

In this article I will show you how to set up a simple Ruby on Rails application using bsSvnBrowser from Bounty Source.

This is a free product and is released under the GPL so feel free to use it for whatever you want - just keep to the rules of the GPL.

Just a quick word of warning: the documentation on the Bounty Source site needs updating and does not work with the latest release.

Let's see if you want to install it first. Have a look at my demo which will allow you to browse two of my projects called user_fu and wibble_fu.

Have a play with the menu and select 'revision info' from the drop down box and click 'Go!'. It'll show you exactly what was changed and when. As you can see, I really went to town with my show method (with a mistake in the syntax!).

Right, I'll assume you have a subversion repository setup with at least one project imported.

BsSvnBrowser will not work unless you have the ruby subversion bindings installed so let's go ahead and do that:

## Debain:
aptitude install libsvn-ruby
## Ubuntu:
apt-get install libsvn-ruby

If you are using another distribution, please refer to the install documentation for that distro.

Using 'irb', have a quick check to see if the ruby bindings have taken:

irb
require 'svn/core'  
## => true
exit

I'm going to create a new Ruby on Rails application for the subversion browser, but you can also install it as a plugin - simply adjust the routes.rb config shown below:

rails svn.domain.com
cd svn.domain.com

Now install the plugin:

./script/plugin install https://svn.bountysource.com/bssvnbrowser/trunk/
mv vendor/plugins/trunk vendor/plugins/bs_svn_browser

Now we need to run a rake task to ensure the assets are linked correctly:

rake bs:svn_browser:link_assets

Once done, we need add a couple of lines to tell BsSvnBrowser where the repository is and to load the correct libraries:

nano config/environment.rb 

## At the bottom add:

BsSvnBrowser.repository_path = '/home/username/repository'

Next:

nano  vendor/plugins/bs_svn_browser/init.rb

## At the bottom add:

require 'svn/repos'

In this example, the SvnBrowser is all I want from the Rails application. As such, the routes.rb needs adjusting so all URL requests are routed to the correct controller:

nano config/routes.rb

## Underneath  # map.connect '', :controller => "welcome" add:

map.connect '*path',  :controller => 'bs_svn_browser', :action => 'distributor'

And finally, remove the index.html file as we don't need it:

rm public/index.html

That's it.

The Rails application is good to go. Just add the domain to Litespeed's virtual host configurations (refer to the Ruby on Rails domain article if unsure).

PickledOnion.

Digg it | del.icio.us | reddit | StumbleUpon

Comments are closed for this article.