Created
January 5, 2012 14:27
-
-
Save rochefort/1565483 to your computer and use it in GitHub Desktop.
extract rails committer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'nokogiri' | |
| require 'open-uri' | |
| require 'pp' | |
| class RailsCommiters | |
| def initialize(url) | |
| @url = url | |
| end | |
| def extract_ranking | |
| Nokogiri::HTML(open(@url)).css('#commits_bucket table tr').inject(Hash.new(0)) do |hash, elm| | |
| unless elm.css('td.message').children.text.strip.match(/^Merge pull request/) | |
| hash[elm.css('td.author').children.text.strip] += 1 | |
| end | |
| hash | |
| end.sort{|x,y| y[1] <=> x[1]} | |
| end | |
| end | |
| if $0 == __FILE__ | |
| rc = RailsCommiters.new('https://github.com/rails/rails/compare/v3.2.2...v3.2.3') | |
| pp rc.extract_ranking | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
not include "Merge pull request"