Rake task for building pull requests

There was a similar pull request some time ago which used a shell script (I can't find it anymore) and someone said that it should be as a rake task instead, so here it is.