Skip to content

Commit

Permalink
Merge pull request #74 from CodingAnarchy/auto_update
Browse files Browse the repository at this point in the history
Refresh Travis CI status every time a file status changes
  • Loading branch information
tombell committed Sep 3, 2015
2 parents 9bf3694 + e53b84f commit 6457c96
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/build-status-view.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{$, View} = require 'atom-space-pen-views'
{GitRepository} = require 'atom'

TravisCi = require 'travis-ci'

Expand All @@ -19,6 +20,7 @@ class BuildStatusView extends View
this.on 'click', => @matrix.toggle()
@attach()
@subscribeToRepo()
@update()

# Internal: Serialize the state of this view.
#
Expand Down Expand Up @@ -74,19 +76,18 @@ class BuildStatusView extends View
atom.project.repositoryForDirectory.bind(atom.project)))
@repoPromise.then (repos) =>
name = atom.config.get('travis-ci-status.travisCiRemoteName')
repo = repos.filter((r) -> /(.)*github\.com/i.test(r.getConfigValue("remote.#{name}.url")))
console.log "DEBUG: ", repo

@update repo
# repo.onDidChangeStatuses @update
repo_list = repos.filter((r) -> /(.)*github\.com/i.test(r.getConfigValue("remote.#{name}.url")))
@repo = repo_list[0]
console.log "DEBUG: ", @repo

# @repo.onDidChangeStatuses @update
@repo.onDidChangeStatus @update


# Internal: Update the repository build status from Travis CI.
#
# Returns nothing.
update: =>
console.log this
return unless @hasParent()

@status.addClass('pending')
Expand Down

0 comments on commit 6457c96

Please sign in to comment.