Refactor travis build to script and add rugged test fix