diff --git a/public/javascripts/lib/utils.js b/public/javascripts/lib/utils.js index 7ab658161a..4756aacb84 100644 --- a/public/javascripts/lib/utils.js +++ b/public/javascripts/lib/utils.js @@ -43,10 +43,14 @@ Utils = { }, filterLog: function(string) { // string = Handlebars.Utils.escapeExpression(string); + string = Utils.stripPaths(string); string = Utils.foldLog(string); string = Deansi.parse(string); return string; }, + stripPaths: function(string) { + return string.replace(/^\/tmp\/travis\/builds(\/[^\/]+){2}\//gm, ''); + }, foldLog: function(string) { string = Utils.unfoldLog(string); var folds = [ diff --git a/public/javascripts/tests/lib/util_test.js b/public/javascripts/tests/lib/util_test.js index 0a0216d95f..71b2b8516e 100644 --- a/public/javascripts/tests/lib/util_test.js +++ b/public/javascripts/tests/lib/util_test.js @@ -7,6 +7,14 @@ describe('Utils', function() { return Utils.foldLog(Utils.foldLog(string)); } + describe('stripPaths', function() { + it('removes the path to the build directory in /tmp', function() { + var source = 'foo\n/tmp/travis/builds/svenfuchs/rails/activesupport/lib/active_support/core_ext/hash/slice.rb:15'; + var result = 'foo\nactivesupport/lib/active_support/core_ext/hash/slice.rb:15' + expect(Utils.stripPaths(source)).toEqual(result); + }); + }); + describe('foldLog', function() { it('folds the "$ bundle install" portion of the log', function() { var examples = [