Skip to content

Commit

Permalink
let's shorten those long pathnames a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Fuchs committed Jul 4, 2011
1 parent 1005e58 commit b90babf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions public/javascripts/lib/utils.js
Expand Up @@ -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 = [
Expand Down
8 changes: 8 additions & 0 deletions public/javascripts/tests/lib/util_test.js
Expand Up @@ -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 = [
Expand Down

0 comments on commit b90babf

Please sign in to comment.