Permalink
Browse files

rake tasks for getting a list of committers by calendar quarter

  • Loading branch information...
1 parent b550408 commit 7a59f4214473bc6e0a5c7d2712a00e2c4f6d42a9 @veganstraightedge veganstraightedge committed Aug 11, 2011
Showing with 62 additions and 1 deletion.
  1. +62 −1 Rakefile
View
@@ -224,7 +224,7 @@ task :todos do
# create array with files to be checked
filesA = Dir['kernel/**/*.*']
-
+
# search for @todo or TODO
filesA.sort!.each do |filename|
File.open(filename) do |file|
@@ -235,3 +235,64 @@ task :todos do
end
end
+
+# shell command for quarterly list of committers
+def quarterly_committers(start_month, year=Time.now.year)
+ "git log --since='#{start_month}/1/#{year}' --until='#{start_month + 2}/31/#{year}' | git shortlog -n -s"
+end
+
+def future?(start_month, year=Time.now.year)
+ require "date"
+
+ if Date.parse("#{start_month}/1/#{year}") > Date.today
+ puts
+ puts "ERROR: That's the future!"
+ puts
+ true
+ elsif year < Time.now.year
+ false
+ else Date.parse("#{start_month + 2}/28/#{year}") > Date.today
+ puts
+ puts "WARNING: That's the current quarter."
+ puts
+ end
+end
+
+namespace :committers do
+ desc "Prints list of committers from first calendar quarter of this year"
+ task :q1 do
+ unless future?(1)
+ sh quarterly_committers(1)
+ end
+ end
+
+ desc "Prints list of committers from second calendar quarter of this year"
+ task :q2 do
+ unless future?(4)
+ sh quarterly_committers(4)
+ end
+ end
+
+ desc "Prints list of committers from third calendar quarter of this year"
+ task :q3 do
+ unless future?(7)
+ sh quarterly_committers(7)
+ end
+ end
+
+ desc "Prints list of committers from fourth calendar quarter of this year"
+ task :q4 do
+ unless future?(10)
+ sh quarterly_committers(10)
+ end
+ end
+
+ namespace :q4 do
+ desc "Prints list of committers from fourth calendar quarter of LAST year"
+ task :last_year do
+ unless future?(10, Time.now.year - 1)
+ sh quarterly_committers(10, Time.now.year - 1)
+ end
+ end
+ end
+end

0 comments on commit 7a59f42

Please sign in to comment.