Parse the authors data

This commit is contained in:
Ionică Bizău 2015-05-28 19:49:44 +03:00
parent e82561ef08
commit 267d6a89a8
1 changed files with 24 additions and 2 deletions

View File

@ -6,6 +6,7 @@ var Ul = require("ul")
, Couleurs = require("couleurs")()
, Gry = require("gry")
, IsThere = require("is-there")
, CliPie = require("cli-pie")
;
// Constants
@ -412,9 +413,30 @@ GitStats.authorsPie = function (options, callback) {
return callback(new Error("Repository is missing."));
}
var repo = new Gry(options.repo);
var repo = new Gry(options.repo)
, pie = null
, pieData = []
;
repo.exec("shortlog -s -n --all", function (err, stdout) {
if (err) { return callback(err); }
console.log(stdout);
lines = stdout.split("\n");
pieData = stdout.split("\n").map(function (c) {
var splits = c.split("\t").map(function (cc) {
return cc.trim();
});
return {
value: parseInt(splits[0])
, label: splits[1]
};
});
pie = new CliPie(20, pieData, {
legend: true
, flat: true
});
callback(null, pie.toString());
});
};