1
0
mirror of https://github.com/chylex/Nextcloud-News.git synced 2025-04-09 19:15:42 +02:00

autogenerate contributors

This commit is contained in:
Bernhard Posselt 2015-09-06 16:53:51 +02:00
parent 70ff47a9b7
commit b2374da2d5
3 changed files with 67 additions and 32 deletions

View File

@ -1,32 +1 @@
# Authors
* [Alessandro Cosentino](https://github.com/cosenal): <cosenal@gmail.com>
* [Bernhard Posselt](https://github.com/BernhardPosselt): <dev@bernhard-posselt.com>
## Designers
* [Jan-Christoph Borchardt](https://github.com/jancborchardt): <hey@jancborchardt.net>
* [Raghu Nayyar](https://github.com/raghunayyar): <me@iraghu.com>
* [Bernhard Posselt](https://github.com/BernhardPosselt): <dev@bernhard-posselt.com>
## Contributors
* [Robin Appelman](https://github.com/icewind1991): <icewind@owncloud.com>
* [Morris Jobke](https://github.com/kabum): <morris.jobke@gmail.com>
* [Lukas Reschke](https://github.com/LukasReschke): <lukas@statuscode.ch>
* [bluehaze](https://github.com/bluehaze)
* [Dave Hou Qingping](https://github.com/houqp): <dave2008713@gmail.com>
* [David Kleuker](https://github.com/davidak): <info@davidak.de>
* [bastei](https://github.com/bastei)
* [Peter Hedlund](https://github.com/phedlund): <support@peterandlinda.com>
* [benediktb](https://github.com/benediktb)
* [Maik Kulbe](https://github.com/mkzero)
* [s17t.net](https://github.com/s17t): <mail+github@s17t.net>
* [John Kristensen](https://github.com/jerrykan)
* [Lutz Schildt](https://github.com/lsmooth): <ls@lsmooth.de>
* [Christopher](https://github.com/Kondou-ger): <kondou@ts.unde.re>
* [Xemle](https://github.com/xemle): <xemle@phtagr.org>
* [Blaimi](https://github.com/Blaimi)
* [Davide Saurino](https://github.com/sub): <davide.saurino@alcacoop.it>
* [Repat](http://repat.de/)
* [David Luhmer](https://github.com/David-Development)
# Contributors

View File

@ -12,3 +12,6 @@ cd ..
phpunit -c phpunit.xml
phpunit -c phpunit.integration.xml
git add appinfo/checksum.json
python3 bin/git/tools/create_contributors.py
git add AUTHORS.md

View File

@ -0,0 +1,63 @@
#!/usr/bin/env python3
import subprocess
import re
import os.path
contribs = subprocess.check_output(['git', 'shortlog', '-e', '-s', '-n'])
contrib_lines = contribs.decode('utf-8').split('\n')
format_regex = r'^\s*(?P<commit_count>\d+)\s*(?P<name>.*\w)\s*<(?P<email>[^\s]+)>$'
def tuple_to_markdown(tuple):
return ('* [%s](mailto:%s)' % (tuple[0], tuple[1]))
def line_to_tuple(line):
result = re.search(format_regex, line)
if result:
return (
result.group('commit_count'),
result.group('name'),
result.group('email')
)
else:
return ()
def group_by_name(tuples):
authors = {}
for tuple in tuples:
if tuple[1] in authors.keys():
authors[tuple[1]]['commits'] += int(tuple[0])
else:
authors[tuple[1]] = {
'commits': int(tuple[0]),
'email': tuple[2]
}
result = []
for author, info in authors.items():
result.append((info['commits'], author, info['email']))
return result
tuples = map(line_to_tuple, contrib_lines)
tuples = filter(lambda x: len(x) > 0, tuples) # filter out empty results
tuples = filter(lambda x: 'Jenkins' not in x[1], tuples) # filter out jenkins
tuples = group_by_name(tuples)
tuples = sorted(tuples, key=lambda x: x[0], reverse=True)
tuples = map(lambda x: (x[1], x[2]), tuples)
authors = map(tuple_to_markdown, tuples)
authors = '\n'.join(authors)
header = '# Contributors'
contents = '%s\n%s' % (header, authors)
# write contents into contributors file
base_dir_diff = 3
current_dir = os.path.dirname(os.path.realpath(__file__))
base_dir = current_dir
for x in range(base_dir_diff):
base_dir = os.path.join(base_dir, os.pardir)
contributors_file = os.path.join(base_dir, 'AUTHORS.md')
with open(contributors_file, 'w') as f:
f.write(contents)