My Fork of Webrat

April 24, 2009

Webrat has become a very important part of my coding toolkit, to the point where its omissions and flaws cause great annoyance. However with the rise of Github we can just fork webrat, fix things and then issue pull requests and hope to get things back into the original.

This is what I have done with Webrat.

However my pull request has been ignored and now has been rejected ticket ? Here again Git provides a solution, I just keep maintaining my current version of the plugin pulling changes from the original. To do this I have to overcome a couple of problems

  • gem generation
  • differentiating my version of the plugin from the original

Gem Generation

Webrat uses a rake task to generate its gem, and does not want github to generate gems. I do want github to generate my gem so I’ve added ‘jeweler’ tasks to the rakefile so that it is easy for me to pull changes and regenerate a .gemspec for github to use. As a gemspec contains a list of every file in the gem, it is very important to update the gempspec every time I pull otherwise my version of the gem will end up missing files.

So I installed jeweler

sudo gem install jeweler

Then added following to rake file

require 'jeweler'
...
Jeweler::Tasks.new(spec)

This adds loads of rake tasks rake -T, and I can use rake gemspec to build my gem.

Differentiating my Version

With a correct gemspec in my repository. Github should do the business and build diabolo-webrat. Now peeps can use this with the same convenience as the original.

I discuss in another article my reasons for forking webrat.