Refactoring the travis scripts to allow easier extension.

Is this worth it? I wouldn't bother - it doesn't save us much in the context of a 20-minute build time, and if the session doesn't end cleanly it can break future sessions.