There's some duplication in here, also for the already existing rake tasks... I'd rather like to see this extracted into a separate method but I might as well do that :-)