Repository: buildr Updated Branches: refs/heads/master f769bac74 -> eb944e154
BUILDR-698 - Correct "Lines of code" example in documentation. Submitted By: Trejkaz. Project: http://git-wip-us.apache.org/repos/asf/buildr/repo Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/eb944e15 Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/eb944e15 Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/eb944e15 Branch: refs/heads/master Commit: eb944e1547e8e9a31d59430c96be89c18364e285 Parents: f769bac Author: Peter Donald <[email protected]> Authored: Tue Jun 17 09:26:34 2014 +1000 Committer: Peter Donald <[email protected]> Committed: Tue Jun 17 09:26:34 2014 +1000 ---------------------------------------------------------------------- doc/extending.textile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/buildr/blob/eb944e15/doc/extending.textile ---------------------------------------------------------------------- diff --git a/doc/extending.textile b/doc/extending.textile index 5a02fc3..cd78153 100644 --- a/doc/extending.textile +++ b/doc/extending.textile @@ -105,11 +105,10 @@ module LinesOfCode project.recursive_task 'loc' do |task| lines = task.prerequisites.map { |path| Dir["#{path}/**/*"] - }.flatten.uniq.inject(0) { |total, file| - total = 0 if total.nil? - if File.file? file then - total + File.readlines(file).count - end + }.uniq.select { |file| + File.file?(file) + }.inject(0) { |total, file| + total + File.readlines(file).count } puts "Project #{project.name} has #{lines} lines of code" end
