refactor coverage script, call it from rake