Wiki source code of Committers
Last modified by Vincent Massol on 2011/10/10 21:28
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | Dynamically finds all XWiki Committers from GitHub: | ||
2 | |||
3 | {{cache}} | ||
4 | {{groovy}} | ||
5 | import groovy.json.* | ||
6 | |||
7 | def committers = [:] | ||
8 | |||
9 | // Find all repositories for the "xwiki" organization | ||
10 | def reposRoot = new JsonSlurper().parseText("http://github.com/api/v2/json/repos/show/xwiki".toURL().text) | ||
11 | reposRoot.repositories.each() { repo -> | ||
12 | // For each repository get the collaborators | ||
13 | def collaboratorsRoot = new JsonSlurper().parseText("http://github.com/api/v2/json/repos/show/xwiki/${repo.name}/collaborators".toURL().text) | ||
14 | collaboratorsRoot.collaborators.each() { collaborator -> | ||
15 | def projects = committers.get(collaborator) | ||
16 | if (projects == null) { | ||
17 | projects = [] | ||
18 | committers.put(collaborator, projects) | ||
19 | } | ||
20 | projects.add("[[${repo.name}>>http://github.com/xwiki/${repo.name}]]") | ||
21 | } | ||
22 | } | ||
23 | |||
24 | println("|=Avatar|=Id|=Name|=Company|=Top level modules") | ||
25 | committers.sort().each() { committer, projects -> | ||
26 | // Get information about committer | ||
27 | def userRoot = new JsonSlurper().parseText("http://github.com/api/v2/json/user/show/${committer}".toURL().text) | ||
28 | def user = userRoot.user | ||
29 | println "|[[image:http://www.gravatar.com/avatar/${user. gravatar_id}>>http://github.com/${committer}]]|${committer}|${user.name}|${user.company}|${projects.join(", ")}" | ||
30 | } | ||
31 | |||
32 | {{/groovy}} | ||
33 | {{/cache}} |