Skip to content

Commit

Permalink
Respect use_travis and use_coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
fnoble committed Jan 16, 2016
1 parent 7090a14 commit ef47d18
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions plugins/thirdparty/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,24 @@
$.when(
$.get("https://api.github.com/repos/" + path + auth),
$.get("https://api.github.com/repos/" + path + "/pulls" + auth),
$.get("https://api.travis-ci.org/repos/" + path + "/branches/" + currentSettings.branch),
$.get("http://cors.io/?u=https://coveralls.io/github/" + path + ".json?branch=" + currentSettings.branch)
currentSettings.use_travis ? $.get("https://api.travis-ci.org/repos/" + path + "/branches/" + currentSettings.branch) : null,
currentSettings.use_coveralls ? $.get("http://cors.io/?u=https://coveralls.io/github/" + path + ".json?branch=" + currentSettings.branch) : null
).then(function(github, github_pr, travis, coveralls) {

var data = {};
data["num_pull_requests"] = github_pr[0].length;
data["pull_requests"] = github_pr[0];
data["num_open_issues"] = github[0]['open_issues_count'];
data["github_repo"] = github[0];
data["build_status"] = travis[0]['branch']['state'];
data["travis"] = travis[0];
data["coveralls"] = JSON.parse(coveralls[0]);
var cc = data["coveralls"]["covered_percent"];
data["code_coverage"] = Number(Math.round(cc+'e2')+'e-2');
if (travis) {
data["build_status"] = travis[0]['branch']['state'];
data["travis"] = travis[0];
}
if (coveralls) {
data["coveralls"] = JSON.parse(coveralls[0]);
var cc = data["coveralls"]["covered_percent"];
data["code_coverage"] = Number(Math.round(cc+'e2')+'e-2');
}
console.log(data);
updateCallback(data);

Expand Down

0 comments on commit ef47d18

Please sign in to comment.