Archive for August, 2010

Ruby: What percentage of the code do I own?

mine = 0 total = 0 require ‘find’ Find.find(".") do |p| Find.prune if File.basename(p).downcase == ".git" next unless p =~ /\.java$/i system "git annotate #{p} > c:\\temp\\foo.txt"   lines = File.open("C:\\temp\\foo.txt","r") { |f| f.read.split(/\n/) } mine += lines.grep(/jfelice/).size total += lines.size print "#{p}: #{mine}/#{total}\n" # Just to show progress end   print "#{mine}\n"

Posted on August 6, 2010 at 1:44 pm by Jason Felice · Permalink · Comments Closed
In: Uncategorized