Skip to content

Commit

Permalink
mark: moving towards making it possible to search by lang
Browse files Browse the repository at this point in the history
  • Loading branch information
mneedham committed Sep 7, 2011
1 parent 1cfc647 commit f97469d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions dashboard.js
Expand Up @@ -31,17 +31,18 @@ function newLinesOfCodeFor(repository, commit, paths, fn) {
});
}

function linesOfCodeFor(repository, hash, paths, fn) {
function linesOfCodeFor(repository, hash, areas, fn) {
exec('cd ' + repository + ' && git checkout -f ' + hash, function (error, stdout, stderr) {
var doc = { hash : hash.toString() }
Step(
log("Calculating lines of code for " + hash, function calculateLineCounts() {
var group = this.group();
paths.forEach(function(path) {
exec('cd ' + repository + ' && find . -type f -regex ".*' + path + '.*\\.scala$" | xargs cat | wc -l', group());
areas.forEach(function(area) {
exec('cd ' + repository + ' && find . -type f -regex ".*' + area.path + '.*\\.scala$" | xargs cat | wc -l', group());
});
}),
function gatherResults(err, lineCounts) {
var paths = _(areas).map(function(obj){ return obj.path });
lineCounts.forEach(function(count, index) { doc[paths[index].split("/")[1]] = count.trim(); });
fn(doc);
}
Expand Down Expand Up @@ -71,7 +72,7 @@ function myFor(repository, commits, onCompletionFn) {
if(copyOfCommits.length == 0) {
onCompletionFn();
} else {
newLinesOfCodeFor(repository, commit, ["src/main", "test/unit", "test/integration", "test/functional", "test/shared", "test/system"], linesForOneHash);
newLinesOfCodeFor(repository, commit, [{path:"src/main"}, {path:"test/unit"}, {path:"test/integration"}, {path:"test/functional"}, {path:"test/shared"}, {path:"test/system"}], linesForOneHash);
}
})();
}
Expand Down

0 comments on commit f97469d

Please sign in to comment.