refactor to travis_cmd bash function

builds on and includes https://github.com/travis-ci/travis-build/pull/272 and https://github.com/travis-ci/travis-build/pull/273, which i'll close

going to test this on staging