Permalink
Browse files

Support contributors who are not linked to GitHub

  • Loading branch information...
1 parent e4593ab commit 0f7b91dd2ee839eb36a0ae5c9aeb34122f25bc2a @MattesGroeger committed May 21, 2014
Showing with 11 additions and 5 deletions.
  1. +11 −5 Rakefile
View
@@ -149,10 +149,16 @@ def contributors(from = nil, to = nil)
# Find all authors that are not site_admin
contributor_map = commits.inject({}) { |hash, commit|
- user = commit.author.login
- if collaborators.index(user).nil?
- change_count = @client.commit(GIT_REPO, commit.sha).stats.total
- hash[user] = hash[user].nil? ? change_count : hash[user] + change_count
+ if commit.author.nil?
+ user = "[#{commit.commit.author.name}](mailto:#{commit.commit.author.email})"
+ hash[user] = 1
+ 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
hash
}
@@ -161,7 +167,7 @@ def contributors(from = nil, to = nil)
contributor_map.keys.sort { |a, b|
contributor_map[b] <=> contributor_map[a]
}.map { |c|
- "@#{c}"
+ "#{c}"
}
end

0 comments on commit 0f7b91d

Please sign in to comment.