mirror of
				https://github.com/sinatra/sinatra
				synced 2023-03-27 23:18:01 -04:00 
			
		
		
		
	improve rake authors
This commit is contained in:
		
							parent
							
								
									f24ddd49a3
								
							
						
					
					
						commit
						e014871de2
					
				
					 1 changed files with 7 additions and 3 deletions
				
			
		
							
								
								
									
										10
									
								
								Rakefile
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								Rakefile
									
										
									
									
									
								
							| 
						 | 
					@ -90,18 +90,22 @@ task :thanks, [:release,:backports] do |t, a|
 | 
				
			||||||
    "(based on commits included in #{a.release}, but not in #{a.backports})"
 | 
					    "(based on commits included in #{a.release}, but not in #{a.backports})"
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
task :authors, [:format, :sep] do |t, a|
 | 
					desc "list of authors"
 | 
				
			||||||
  a.with_defaults :format => "%s (%d)", :sep => ', '
 | 
					task :authors, [:commit_range, :format, :sep] do |t, a|
 | 
				
			||||||
 | 
					  a.with_defaults :format => "%s (%d)", :sep => ", "
 | 
				
			||||||
  authors = Hash.new { |h,k| h[k] = 0 }
 | 
					  authors = Hash.new { |h,k| h[k] = 0 }
 | 
				
			||||||
  blake   = "Blake Mizerany"
 | 
					  blake   = "Blake Mizerany"
 | 
				
			||||||
 | 
					  overall = 0
 | 
				
			||||||
  mapping = {
 | 
					  mapping = {
 | 
				
			||||||
    "blake.mizerany@gmail.com" => blake, "bmizerany" => blake,
 | 
					    "blake.mizerany@gmail.com" => blake, "bmizerany" => blake,
 | 
				
			||||||
    "a_user@mac.com" => blake, "ichverstehe" => "Harry Vangberg",
 | 
					    "a_user@mac.com" => blake, "ichverstehe" => "Harry Vangberg",
 | 
				
			||||||
    "Wu Jiang (nouse)" => "Wu Jiang" }
 | 
					    "Wu Jiang (nouse)" => "Wu Jiang" }
 | 
				
			||||||
  `git shortlog -s`.lines.map do |line|
 | 
					  `git shortlog -s #{a.commit_range}`.lines.map do |line|
 | 
				
			||||||
    num, name = line.split("\t", 2).map(&:strip)
 | 
					    num, name = line.split("\t", 2).map(&:strip)
 | 
				
			||||||
    authors[mapping[name] || name] += num.to_i
 | 
					    authors[mapping[name] || name] += num.to_i
 | 
				
			||||||
 | 
					    overall += num.to_i
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					  puts "#{overall} commits by #{authors.count} authors:"
 | 
				
			||||||
  puts authors.sort_by { |n,c| -c }.map { |e| a.format % e }.join(a.sep)
 | 
					  puts authors.sort_by { |n,c| -c }.map { |e| a.format % e }.join(a.sep)
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue