Skip to content

Commit

Permalink
Support contributors who are not linked to GitHub
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattes Groeger committed May 21, 2014
1 parent e4593ab commit 0f7b91d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Rakefile
Expand Up @@ -149,10 +149,16 @@ def contributors(from = nil, to = nil)


# Find all authors that are not site_admin # Find all authors that are not site_admin
contributor_map = commits.inject({}) { |hash, commit| contributor_map = commits.inject({}) { |hash, commit|
user = commit.author.login if commit.author.nil?
if collaborators.index(user).nil? user = "[#{commit.commit.author.name}](mailto:#{commit.commit.author.email})"
change_count = @client.commit(GIT_REPO, commit.sha).stats.total hash[user] = 1
hash[user] = hash[user].nil? ? change_count : hash[user] + change_count else
login = commit.author.login
user = "@#{login}"
if collaborators.index(login).nil? # exclude repo maintainer
change_count = @client.commit(GIT_REPO, commit.sha).stats.total
hash[user] = hash[user].nil? ? change_count : hash[user] + change_count
end
end end
hash hash
} }
Expand All @@ -161,7 +167,7 @@ def contributors(from = nil, to = nil)
contributor_map.keys.sort { |a, b| contributor_map.keys.sort { |a, b|
contributor_map[b] <=> contributor_map[a] contributor_map[b] <=> contributor_map[a]
}.map { |c| }.map { |c|
"@#{c}" "#{c}"
} }
end end


Expand Down

0 comments on commit 0f7b91d

Please sign in to comment.