mirror of
https://github.com/IonicaBizau/git-stats.git
synced 2024-12-22 13:22:11 +01:00
Parse the authors data
This commit is contained in:
parent
e82561ef08
commit
267d6a89a8
1 changed files with 24 additions and 2 deletions
26
lib/index.js
26
lib/index.js
|
@ -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());
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue