@Travis.Log = FOLDS: schema: /(\$ (?:bundle exec )?rake( db:create)? db:schema:load[\s\S]*?-- assume_migrated_upto_version[\s\S]*?<\/p>\n.*<\/p>)/g migrate: /(\$ (?:bundle exec )?rake( db:create)? db:migrate[\s\S]*== +\w+: migrated \(.*\) =+)/g bundle: /(\$ bundle install.*<\/p>\n((Updating|Using|Installing|Fetching|remote:|Receiving|Resolving).*?<\/p>\n|<\/p>\n)*)/g exec: /([\/\w]*.rvm\/rubies\/[\S]*?\/(ruby|rbx|jruby) .*?<\/p>)/g filter: (log) -> log = @escapeHtml(log) log = @deansi(log) log = log.replace(/\r/g, '') log = @numberLines(log) log = @fold(log) log = log.replace(/\n/g, '') log stripPaths: (log) -> log.replace /\/home\/vagrant\/builds(\/[^\/\n]+){2}\//g, '' escapeHtml: (log) -> Handlebars.Utils.escapeExpression log escapeRuby: (log) -> log.replace /#<(\w+.*?)>/, '#<$1>' numberLines: (log) -> result = '' $.each log.trim().split('\n'), (ix, line) -> number = ix + 1 path = Travis.Log.location().substr(1).replace(/\/L\d+/, '') + '/L' + number result += '

%@%@

\n'.fmt(path, path, number, number, line) result.trim() deansi: (log) -> log = log.replace(/\r\r/g, '\r').replace(/\033\[K\r/g, '\r').replace(/^.*\r(?!$)/g, '').replace(/\[2K/g, '').replace(/\033\(B/g, '') ansi = ansiparse(log) text = '' ansi.forEach (part) -> classes = [] part.foreground and classes.push(part.foreground) part.background and classes.push('bg-' + part.background) part.bold and classes.push('bold') part.italic and classes.push('italic') text += (if classes.length then ('' + part.text + '') else part.text) text.replace /\033/g, '' fold: (log) -> log = @unfold(log) $.each Travis.Log.FOLDS, (name, pattern) -> log = log.replace(pattern, -> '
' + arguments[1].trim() + '
' ) log unfold: (log) -> log.replace /
([\s\S]*?)<\/div>/g, '$1\n' location: -> window.location.hash