Skip to content

Instantly share code, notes, and snippets.

@rochefort
Created January 5, 2012 14:27
Show Gist options
  • Select an option

  • Save rochefort/1565483 to your computer and use it in GitHub Desktop.

Select an option

Save rochefort/1565483 to your computer and use it in GitHub Desktop.
extract rails committer
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
@rochefort
Copy link
Author

not include "Merge pull request"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment