This commit is contained in:
Sven Fuchs 2012-06-24 15:39:15 +02:00
parent aea4375860
commit 2af55e9387
16 changed files with 144 additions and 144 deletions

View File

@ -10,11 +10,9 @@ require 'templates'
require 'controllers' require 'controllers'
require 'routes' require 'routes'
# Travis = window.Travis
Travis.store = DS.Store.extend( Travis.store = DS.Store.extend(
revision: 4 revision: 4
adapter: Travis.RestAdapter.create() adapter: Travis.RestAdapter.create()
# adapter: Travis.FixtureAdapter.create()
).create() ).create()
Travis.initialize() Travis.initialize()

View File

@ -3,12 +3,7 @@ Travis.RepositoriesController = Em.ArrayController.extend()
Travis.RepositoryController = Em.ObjectController.extend(Travis.Urls.Repository) Travis.RepositoryController = Em.ObjectController.extend(Travis.Urls.Repository)
Travis.TabsController = Em.Controller.extend() Travis.TabsController = Em.Controller.extend()
Travis.HistoryController = Em.ArrayController.extend() Travis.HistoryController = Em.ArrayController.extend()
Travis.JobController = Em.ObjectController.extend() Travis.BuildController = Em.ObjectController.extend(Travis.Urls.Commit)
Travis.LoadingController = Em.Controller.extend() Travis.JobController = Em.ObjectController.extend(Travis.Urls.Commit)
Travis.BuildController = Em.ObjectController.extend
classes: (->
Travis.Helpers.colorForResult(@getPath('content.result'))
).property('content.result')

View File

@ -1,5 +1,4 @@
require 'ext/ember/bound_helper' require 'ext/ember/bound_helper'
require 'travis/log'
safe = (string) -> safe = (string) ->
new Handlebars.SafeString(string) new Handlebars.SafeString(string)
@ -20,16 +19,13 @@ Ember.registerBoundHelper 'formatDuration', (duration, options) ->
safe Travis.Helpers.timeInWords(duration) safe Travis.Helpers.timeInWords(duration)
Ember.registerBoundHelper 'formatCommit', (commit, options) -> Ember.registerBoundHelper 'formatCommit', (commit, options) ->
if commit safe Travis.Helpers.formatCommit(commit.get('sha'), commit.get('branch')) if commit
branch = commit.get('branch') || ''
branch = " (#{branch})" if branch
safe (commit.get('sha') || '').substr(0, 7) + branch
Ember.registerBoundHelper 'formatSha', (sha, options) -> Ember.registerBoundHelper 'formatSha', (sha, options) ->
safe (sha || '').substr(0, 7) safe Travis.Helpers.formatSha(sha)
Ember.registerBoundHelper 'pathFrom', (url, options) -> Ember.registerBoundHelper 'pathFrom', (url, options) ->
safe (url || '').split('/').pop() safe Travis.Helpers.pathFrom(url)
Ember.registerBoundHelper 'formatMessage', (message, options) -> Ember.registerBoundHelper 'formatMessage', (message, options) ->
safe Travis.Helpers.formatMessage(message, options) safe Travis.Helpers.formatMessage(message, options)
@ -38,5 +34,5 @@ Ember.registerBoundHelper 'formatConfig', (config, options) ->
safe Travis.Helpers.formatConfig(config) safe Travis.Helpers.formatConfig(config)
Ember.registerBoundHelper 'formatLog', (log, options) -> Ember.registerBoundHelper 'formatLog', (log, options) ->
Travis.Log.filter(log) if log Travis.Helpers.formatLog(log) || ''

View File

@ -1,7 +1,18 @@
require 'travis/log'
@Travis.Helpers = @Travis.Helpers =
safe: (string) ->
new Handlebars.SafeString(string)
colorForResult: (result) -> colorForResult: (result) ->
(if result is 0 then 'green' else (if result is 1 then 'red' else null)) (if result is 0 then 'green' else (if result is 1 then 'red' else null))
formatCommit: (sha, branch) ->
Travis.Helpers.formatSha(sha) + if branch then " (#{branch})" else ''
formatSha: (sha) ->
(sha || '').substr(0, 7)
formatConfig: (config) -> formatConfig: (config) ->
config = $.only config, 'rvm', 'gemfile', 'env', 'otp_release', 'php', 'node_js', 'scala', 'jdk', 'python', 'perl' config = $.only config, 'rvm', 'gemfile', 'env', 'otp_release', 'php', 'node_js', 'scala', 'jdk', 'python', 'perl'
values = $.map config, (value, key) -> values = $.map config, (value, key) ->
@ -14,6 +25,12 @@
message = message.split(/\n/)[0] if options.short message = message.split(/\n/)[0] if options.short
@_emojize(@_escape(message)).replace /\n/g, '<br/>' @_emojize(@_escape(message)).replace /\n/g, '<br/>'
formatLog: (log) ->
Travis.Log.filter(log)
pathFrom: (url) ->
(url || '').split('/').pop()
timeAgoInWords: (date) -> timeAgoInWords: (date) ->
$.timeago.distanceInWords date $.timeago.distanceInWords date

View File

@ -20,17 +20,17 @@
'%@.png'.fmt @get('slug') '%@.png'.fmt @get('slug')
).property('slug') ).property('slug')
Commit:
urlAuthor: (->
'mailto:%@'.fmt @getPath('commit.authorEmail')
).property('commit')
urlCommitter: (->
'mailto:%@'.fmt @getPath('commit.committerEmail')
).property('commit')
Build: Build:
githubCommit: (-> githubCommit: (->
'http://github.com/%@/commit/%@'.fmt @getPath('repository.slug'), @getPath('commit.sha') 'http://github.com/%@/commit/%@'.fmt @getPath('repository.slug'), @getPath('commit.sha')
).property('repository.slug', 'commit.sha') ).property('repository.slug', 'commit.sha')
Commit:
urlAuthor: (->
'mailto:%@'.fmt @getPath('commit.authorEmail')
).property()
urlCommitter: (->
'mailto:%@'.fmt @getPath('commit.committerEmail')
).property()

View File

@ -1,13 +1,13 @@
require 'travis/model' require 'travis/model'
@Travis.Repository = Travis.Model.extend @Travis.Repository = Travis.Model.extend
slug: DS.attr('string') slug: DS.attr('string')
description: DS.attr('string') description: DS.attr('string')
last_build_id: DS.attr('number') lastBuildId: DS.attr('number')
last_build_number: DS.attr('string') lastBuildNumber: DS.attr('string')
last_build_result: DS.attr('number') lastBuildResult: DS.attr('number')
last_build_started_at: DS.attr('string') lastBuildStarted_at: DS.attr('string')
last_build_finished_at: DS.attr('string') lastBuildFinished_at: DS.attr('string')
primaryKey: 'slug' primaryKey: 'slug'
@ -29,11 +29,11 @@ require 'travis/model'
(@get('slug') || @_id).split('/')[1] (@get('slug') || @_id).split('/')[1]
).property('owner', 'name'), ).property('owner', 'name'),
last_build_duration: (-> lastBuildDuration: (->
duration = @getPath('data.last_build_duration') duration = @getPath('data.lastBuildDuration')
duration = Travis.Helpers.durationFrom(@get('last_build_started_at'), @get('last_build_finished_at')) unless duration duration = Travis.Helpers.durationFrom(@get('lastBuildStarted_at'), @get('lastBuildFinished_at')) unless duration
duration duration
).property('data.last_build_duration', 'last_build_started_at', 'last_build_finished_at') ).property('data.lastBuildDuration', 'lastBuildStartedAt', 'lastBuildFinishedAt')
stats: (-> stats: (->
# @get('_stats') || $.get("https://api.github.com/repos/#{@get('slug')}", (data) => # @get('_stats') || $.get("https://api.github.com/repos/#{@get('slug')}", (data) =>
@ -46,8 +46,8 @@ require 'travis/model'
Travis.Repository.select(self.get('id')) Travis.Repository.select(self.get('id'))
tick: -> tick: ->
@notifyPropertyChange 'last_build_duration' @notifyPropertyChange 'lastBuildDuration'
@notifyPropertyChange 'last_build_finished_at' @notifyPropertyChange 'lastBuildFinishedAt'
@Travis.Repository.reopenClass @Travis.Repository.reopenClass
recent: -> recent: ->

View File

@ -12,7 +12,7 @@ require 'travis/model'
state: DS.attr('string') state: DS.attr('string')
name: DS.attr('string') name: DS.attr('string')
host: DS.attr('string') host: DS.attr('string')
last_seen_at: DS.attr('string') lastSeenAt: DS.attr('string')
isTesting: (-> isTesting: (->
@get('state') == 'working' && !!@getPath('payload.config') @get('state') == 'working' && !!@getPath('payload.config')

View File

@ -19,6 +19,7 @@ require 'hax0rs'
connectOutlets: (router) -> connectOutlets: (router) ->
repositories = Travis.Repository.find() repositories = Travis.Repository.find()
router.set('repositories', repositories) router.set('repositories', repositories)
router.set('job', undefined)
router.connectLeft(repositories) router.connectLeft(repositories)
index: Em.Route.extend index: Em.Route.extend
@ -30,9 +31,9 @@ require 'hax0rs'
repositories = router.get('repositories') repositories = router.get('repositories')
onceLoaded repositories, => onceLoaded repositories, =>
repository = repositories.get('firstObject') repository = repositories.get('firstObject')
build = Travis.Build.find(repository.get('last_build_id')) build = Travis.Build.find(repository.get('lastBuildId'))
router.connectRepository(repository) router.connectRepository(repository)
router.connectTabs(repository) router.connectTabs()
router.connectBuild(build) router.connectBuild(build)
repository: Em.Route.extend repository: Em.Route.extend
@ -45,9 +46,7 @@ require 'hax0rs'
router.deserializeRepository(params) router.deserializeRepository(params)
connectOutlets: (router, repository) -> connectOutlets: (router, repository) ->
router.set('repository', repository)
router.connectRepository(repository) router.connectRepository(repository)
router.connectTabs(repository)
current: Em.Route.extend current: Em.Route.extend
route: '/' route: '/'
@ -56,7 +55,7 @@ require 'hax0rs'
repository = router.get('repository') repository = router.get('repository')
onceLoaded repository, -> # TODO should not need to wait here, right? onceLoaded repository, -> # TODO should not need to wait here, right?
build = repository.get('lastBuild') build = repository.get('lastBuild')
router.connectTabs(repository) router.connectTabs()
router.connectBuild(build) router.connectBuild(build)
builds: Em.Route.extend builds: Em.Route.extend
@ -65,6 +64,7 @@ require 'hax0rs'
connectOutlets: (router) -> connectOutlets: (router) ->
repository = router.get('repository') repository = router.get('repository')
onceLoaded repository, => # TODO hrm, otherwise it gets builds?repository_id=null onceLoaded repository, => # TODO hrm, otherwise it gets builds?repository_id=null
router.connectTabs()
router.connectBuilds(repository.get('builds')) router.connectBuilds(repository.get('builds'))
build: Em.Route.extend build: Em.Route.extend
@ -72,7 +72,7 @@ require 'hax0rs'
connectOutlets: (router, build) -> connectOutlets: (router, build) ->
build = Travis.Build.find(build.id) unless build instanceof Travis.Build # what? build = Travis.Build.find(build.id) unless build instanceof Travis.Build # what?
router.setPath('tabsController.build', build) router.connectTabs(build)
router.connectBuild(build) router.connectBuild(build)
job: Em.Route.extend job: Em.Route.extend
@ -80,8 +80,7 @@ require 'hax0rs'
connectOutlets: (router, job) -> connectOutlets: (router, job) ->
job = Travis.Job.find(job.id) unless job instanceof Travis.Job # what? job = Travis.Job.find(job.id) unless job instanceof Travis.Job # what?
router.setPath('tabsController.build', job.get('build')) router.connectTabs(job.get('build'), job)
router.setPath('tabsController.job', job)
router.connectJob(job) router.connectJob(job)
@ -89,10 +88,13 @@ require 'hax0rs'
@get('applicationController').connectOutlet(outletName: 'left', name: 'repositories', context: repositories) @get('applicationController').connectOutlet(outletName: 'left', name: 'repositories', context: repositories)
connectRepository: (repository) -> connectRepository: (repository) ->
@set('repository', repository)
@get('applicationController').connectOutlet(outletName: 'main', name: 'repository', context: repository) @get('applicationController').connectOutlet(outletName: 'main', name: 'repository', context: repository)
connectTabs: (repository) -> connectTabs: (build, job) ->
@setPath('tabsController.repository', repository) @setPath('tabsController.repository', @get('repository'))
@setPath('tabsController.build', build)
@setPath('tabsController.job', job)
@get('repositoryController').connectOutlet(outletName: 'tabs', name: 'tabs') @get('repositoryController').connectOutlet(outletName: 'tabs', name: 'tabs')
connectBuilds: (builds) -> connectBuilds: (builds) ->

View File

@ -2,7 +2,7 @@
<dl class="summary clearfix"> <dl class="summary clearfix">
<div class="left"> <div class="left">
<dt>{{t builds.name}}</dt> <dt>{{t builds.name}}</dt>
<dd class="number"><a {{bindAttr href="urlBuild"}}>{{number}}</a></dd> <dd class="number"><a {{action viewBuild href=true}}>{{number}}</a></dd>
<dt class="finished_at_label">{{t builds.finished_at}}</dt> <dt class="finished_at_label">{{t builds.finished_at}}</dt>
<dd class="finished_at timeago" {{bindAttr title="finished_at"}}>{{formatTime finished_at}}</dd> <dd class="finished_at timeago" {{bindAttr title="finished_at"}}>{{formatTime finished_at}}</dd>
<dt>{{t builds.duration}}</dt> <dt>{{t builds.duration}}</dt>
@ -18,7 +18,7 @@
{{/if}} {{/if}}
{{#if commit.authorName}} {{#if commit.authorName}}
<dt>{{t builds.author}}</dt> <dt>{{t builds.author}}</dt>
<dd class="author"><a {{bindAttr href="view.urlAuthor"}}>{{commit.authorName}}</a></dd> <dd class="author"><a {{bindAttr href="urlAuthor"}}>{{commit.authorName}}</a></dd>
{{/if}} {{/if}}
{{#if commit.committerName}} {{#if commit.committerName}}
<dt>{{t builds.committer}}</dt> <dt>{{t builds.committer}}</dt>
@ -37,7 +37,8 @@
{{#if isLoaded}} {{#if isLoaded}}
{{#if view.isMatrix}} {{#if view.isMatrix}}
{{view Travis.JobsView}} {{view Travis.JobsView jobsBinding="view.requiredJobs" required="true"}}
{{view Travis.JobsView jobsBinding="view.allowedFailureJobs"}}
{{else}} {{else}}
{{view Travis.LogView contextBinding="jobs.firstObject"}} {{view Travis.LogView contextBinding="jobs.firstObject"}}
{{/if}} {{/if}}

View File

@ -1,30 +1,11 @@
<table id="jobs"> {{#if view.jobs.length}}
<caption>{{t jobs.build_matrix}}</caption> <table id="jobs">
<thead>
<tr>
{{#each configKeys}}
<th>{{this}}</th>
{{/each}}
</tr>
</thead>
<tbody>
{{#each view.requiredJobs}}
<tr {{bindAttr class="color"}}>
<td class="number"><a {{action viewJob href=true}}>#{{number}}</a></td>
<td class="duration" {{bindAttr title="started_at"}}>{{formatDuration duration}}</td>
<td class="finished_at timeago" {{bindAttr title="finished_at"}}>{{formatTime finished_at}}</td>
{{#each configValues}}
<td>{{this}}</td>
{{/each}}
</tr>
{{/each}}
</tbody>
</table>
{{#if view.isFailureMatrix}}
<table id="allow_failure_builds">
<caption> <caption>
{{t jobs.allowed_failures}}{{whats_this allow_failure_help}} {{#if view.required}}
{{t jobs.build_matrix}}
{{else}}
{{t jobs.allowed_failures}}{{whats_this allow_failure_help}}
{{/if}}
</caption> </caption>
<thead> <thead>
<tr> <tr>
@ -34,7 +15,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{#each allowedFailureJobs}} {{#each view.jobs}}
<tr {{bindAttr class="color"}}> <tr {{bindAttr class="color"}}>
<td class="number"><a {{action viewJob href=true}}>#{{number}}</a></td> <td class="number"><a {{action viewJob href=true}}>#{{number}}</a></td>
<td class="duration" {{bindAttr title="started_at"}}>{{formatDuration duration}}</td> <td class="duration" {{bindAttr title="started_at"}}>{{formatDuration duration}}</td>
@ -47,24 +28,25 @@
</tbody> </tbody>
</table> </table>
<div id="allow_failure_help" class="context_help"> {{#unless view.required}}
<div class="context_help_caption">{{t "jobs.allowed_failures"}}</div> <div id="allow_failure_help" class="context_help">
<div class="context_help_body"> <div class="context_help_caption">{{t "jobs.allowed_failures"}}</div>
<p> <div class="context_help_body">
Allowed Failures are items in your build matrix that are allowed to <p>
fail without causing the entire build to be shown as failed. This lets you add Allowed Failures are items in your build matrix that are allowed to
in experimental and preparatory builds to test against versions or fail without causing the entire build to be shown as failed. This lets you add
configurations that you are not ready to officially support. in experimental and preparatory builds to test against versions or
</p> configurations that you are not ready to officially support.
<p> </p>
You can define allowed failures in the build matrix as follows: <p>
</p> You can define allowed failures in the build matrix as follows:
<pre> </p>
matrix: <pre>
allow_failures: matrix:
- rvm: ruby-head allow_failures:
</pre> - rvm: ruby-head
</pre>
</div>
</div> </div>
</div> {{/unless}}
{{/if}} {{/if}}

View File

@ -1,8 +1,8 @@
<div {{bindAttr class="color"}}> <div {{bindAttr class="classes"}}>
<dl class="summary clearfix"> <dl class="summary clearfix">
<div class="left"> <div class="left">
<dt>Job</dt> <dt>Job</dt>
<dd class="number"><a {{bindAttr href="urlJob"}}>{{number}}</a></dd> <dd class="number"><a {{action viewJob href=true}}>{{number}}</a></dd>
<dt class="finished_at_label">{{t jobs.finished_at}}</dt> <dt class="finished_at_label">{{t jobs.finished_at}}</dt>
<dd class="finished_at timeago" {{bindAttr title="finished_at"}}>{{formatTime finished_at}}</dd> <dd class="finished_at timeago" {{bindAttr title="finished_at"}}>{{formatTime finished_at}}</dd>
<dt>{{t jobs.duration}}</dt> <dt>{{t jobs.duration}}</dt>
@ -12,17 +12,17 @@
<div class="right"> <div class="right">
<dt>{{t jobs.commit}}</dt> <dt>{{t jobs.commit}}</dt>
<dd class="commit-hash"><a {{bindAttr href="urlGithubCommit"}}>{{formatCommit commit}}</a></dd> <dd class="commit-hash"><a {{bindAttr href="urlGithubCommit"}}>{{formatCommit commit}}</a></dd>
{{#if commit.compare_url}} {{#if commit.compareUrl}}
<dt>{{t jobs.compare}}</dt> <dt>{{t jobs.compare}}</dt>
<dd class="compare_view"><a {{bindAttr href="commit.compare_url"}}>{{pathFrom commit.compare_url}}</a></dd> <dd class="compare_view"><a {{bindAttr href="commit.compareUrl"}}>{{pathFrom commit.compareUrl}}</a></dd>
{{/if}} {{/if}}
{{#if commit.author_name}} {{#if commit.authorName}}
<dt>{{t jobs.author}}</dt> <dt>{{t jobs.author}}</dt>
<dd class="author"><a {{bindAttr href="urlAuthor"}}>{{commit.author_name}}</a></dd> <dd class="author"><a {{bindAttr href="urlAuthor"}}>{{commit.authorName}}</a></dd>
{{/if}} {{/if}}
{{#if commit.committer_name}} {{#if commit.committerName}}
<dt>{{t jobs.committer}}</dt> <dt>{{t jobs.committer}}</dt>
<dd class="committer"><a {{bindAttr href="urlCommitter"}}>{{commit.committer_name}}</a></dd> <dd class="committer"><a {{bindAttr href="urlCommitter"}}>{{commit.committerName}}</a></dd>
{{/if}} {{/if}}
</div> </div>

View File

@ -1 +0,0 @@
loading stuff ...

View File

@ -5,14 +5,14 @@
<li {{bindAttr class="view.classes"}}> <li {{bindAttr class="view.classes"}}>
<div class="wrapper"> <div class="wrapper">
<a {{action viewCurrent href=true}} class="slug">{{slug}}</a> <a {{action viewCurrent href=true}} class="slug">{{slug}}</a>
<a {{action viewBuild href=true context="view.lastBuild"}} class="build">#{{last_build_number}}</a> <a {{action viewBuild href=true context="lastBuild"}} class="build">#{{lastBuildNumber}}</a>
</div> </div>
<p class="summary"> <p class="summary">
<span class="duration_label">{{t repositories.duration}}:</span> <span class="duration_label">{{t repositories.duration}}:</span>
<abbr class="duration" {{bindAttr title="last_build_started_at"}}>{{formatDuration last_build_duration}}</abbr>, <abbr class="duration" {{bindAttr title="lastBuildStartedAt"}}>{{formatDuration lastBuildDuration}}</abbr>,
<span class="finished_at_label">{{t repositories.finished_at}}:</span> <span class="finished_at_label">{{t repositories.finished_at}}:</span>
<abbr class="finished_at timeago" {{bindAttr title="last_build_finished_at"}}>{{formatTime last_build_finished_at}}</abbr> <abbr class="finished_at timeago" {{bindAttr title="lastBuildFinishedAt"}}>{{formatTime lastBuildFinished_at}}</abbr>
</p> </p>
{{#if description}} {{#if description}}
<p class="description">{{description}}</p> <p class="description">{{description}}</p>

View File

@ -1,25 +1,31 @@
Travis.ApplicationView = Em.View.extend templateName: 'application' Travis.ApplicationView = Em.View.extend
Travis.RepositoriesView = Em.View.extend templateName: 'repositories/list' templateName: 'application'
Travis.RepositoriesView = Em.View.extend
templateName: 'repositories/list'
Travis.RepositoriesItemView = Em.View.extend Travis.RepositoriesItemView = Em.View.extend
classes: (-> classes: (->
color = Travis.Helpers.colorForResult(@getPath('context.last_build_result')) color = Travis.Helpers.colorForResult(@getPath('repository.lastBuildResult'))
classes = ['repository', color] classes = ['repository', color]
classes.push 'selected' if @getPath('context.selected') classes.push 'selected' if @getPath('repository.selected')
classes.join(' ') classes.join(' ')
).property('context.last_build_result', 'context.selected') ).property('repository.lastBuildResult', 'repository.selected')
lastBuild: (-> lastBuild: (->
owner: @getPath('context.owner') owner: @getPath('repository.owner')
name: @getPath('context.name') name: @getPath('repository.name')
id: @getPath('context.last_build_id') id: @getPath('repository.lastBuildId')
).property('context.last_build_id') ).property('repository.owner', 'repository.name', 'repository.lastBuildId')
Travis.RepositoryView = Em.View.extend
templateName: 'repositories/show'
Travis.RepositoryView = Em.View.extend templateName: 'repositories/show' Travis.TabsView = Em.View.extend
Travis.TabsView = Em.View.extend templateName: 'repositories/tabs' templateName: 'repositories/tabs'
Travis.HistoryView = Em.View.extend templateName: 'builds/list'
Travis.LoadingView = Em.View.extend templateName: 'loading' Travis.HistoryView = Em.View.extend
templateName: 'builds/list'
Travis.BuildsItemView = Em.View.extend Travis.BuildsItemView = Em.View.extend
classes: (-> classes: (->
@ -29,25 +35,32 @@ Travis.BuildsItemView = Em.View.extend
Travis.BuildView = Em.View.extend Travis.BuildView = Em.View.extend
templateName: 'builds/show' templateName: 'builds/show'
classes: (->
Travis.Helpers.colorForResult(@get('result'))
).property('result')
isMatrix: (-> isMatrix: (->
@getPath('context.data.job_ids.length') > 1 @getPath('context.data.job_ids.length') > 1
).property() # TODO if i bind this to 'context.data.job_ids.length', that breaks the entire view (as if context was always undefined)
requiredJobs: (->
@getPath('context.jobs').filter((job) -> job.get('allow_failure') != true)
).property() # TODO same here with binding to 'context.data.job_ids'
allowedFailureJobs: (->
@getPath('context.jobs').filter((job) -> job.get('allow_failure'))
).property() ).property()
Travis.JobsView = Em.View.extend Travis.JobsView = Em.View.extend
templateName: 'jobs/list' templateName: 'jobs/list'
isFailureMatrix: (-> Travis.JobView = Em.View.extend
@getPath('context.allowedFailureJobs.length') > 0 templateName: 'jobs/show'
).property('context.allowedFailureJobs.length')
requiredJobs: (-> classes: (->
@getPath('context.jobs').filter (job) -> job.get('allow_failure') != true Travis.Helpers.colorForResult(@get('result'))
).property('context.jobs') ).property('result')
allowedFailureJobs: (-> Travis.LogView = Em.View.extend
@getPath('context.jobs').filter (job) -> job.get('allow_failure') templateName: 'jobs/log'
).property('context.jobs')
Travis.JobView = Em.View.extend templateName: 'jobs/show'
Travis.LogView = Em.View.extend templateName: 'jobs/log'

View File

@ -6,10 +6,10 @@
exec: /(<p.*?\/a>[\/\w]*.rvm\/rubies\/[\S]*?\/(ruby|rbx|jruby) .*?<\/p>)/g exec: /(<p.*?\/a>[\/\w]*.rvm\/rubies\/[\S]*?\/(ruby|rbx|jruby) .*?<\/p>)/g
filter: (log) -> filter: (log) ->
log = @escapeHtml(log) log = @escape(log)
log = @deansi(log) log = @deansi(log)
log = log.replace(/\r/g, '') log = log.replace(/\r/g, '')
log = @numberLines(log) log = @number(log)
log = @fold(log) log = @fold(log)
log = log.replace(/\n/g, '') log = log.replace(/\n/g, '')
log log
@ -17,19 +17,18 @@
stripPaths: (log) -> stripPaths: (log) ->
log.replace /\/home\/vagrant\/builds(\/[^\/\n]+){2}\//g, '' log.replace /\/home\/vagrant\/builds(\/[^\/\n]+){2}\//g, ''
escapeHtml: (log) -> escape: (log) ->
Handlebars.Utils.escapeExpression log Handlebars.Utils.escapeExpression log
escapeRuby: (log) -> escapeRuby: (log) ->
log.replace /#<(\w+.*?)>/, '#&lt;$1&gt;' log.replace /#<(\w+.*?)>/, '#&lt;$1&gt;'
numberLines: (log) -> number: (log) ->
result = '' result = ''
$.each log.trim().split('\n'), (ix, line) -> $.each log.trim().split('\n'), (ix, line) ->
number = ix + 1 number = ix + 1
path = Travis.Log.location().substr(1).replace(/\/L\d+/, '') + '/L' + number path = Travis.Log.location().substr(1).replace(/\/L\d+/, '') + '/L' + number
result += '<p><a href=\'#%@\' id=\'%@\' name=\'L%@\'>%@</a>%@</p>\n'.fmt(path, path, number, number, line) result += '<p><a href=\'#%@\' id=\'%@\' name=\'L%@\'>%@</a>%@</p>\n'.fmt(path, path, number, number, line)
result.trim() result.trim()
deansi: (log) -> deansi: (log) ->
@ -43,7 +42,6 @@
part.bold and classes.push('bold') part.bold and classes.push('bold')
part.italic and classes.push('italic') part.italic and classes.push('italic')
text += (if classes.length then ('<span class=\'' + classes.join(' ') + '\'>' + part.text + '</span>') else part.text) text += (if classes.length then ('<span class=\'' + classes.join(' ') + '\'>' + part.text + '</span>') else part.text)
text.replace /\033/g, '' text.replace /\033/g, ''
fold: (log) -> fold: (log) ->
@ -52,7 +50,6 @@
log = log.replace(pattern, -> log = log.replace(pattern, ->
'<div class=\'fold ' + name + '\'>' + arguments[1].trim() + '</div>' '<div class=\'fold ' + name + '\'>' + arguments[1].trim() + '</div>'
) )
log log
unfold: (log) -> unfold: (log) ->

File diff suppressed because one or more lines are too long