More robust handling of Travis timeouts
Refactor Rake task and add tests.