mirror of
https://github.com/nanoy42/coope
synced 2024-11-24 12:23:11 +00:00
Add command gencontributors and fix about page
This commit is contained in:
parent
b26b304672
commit
d442545d17
4 changed files with 26 additions and 9 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -45,3 +45,4 @@ static/
|
||||||
Pipfile
|
Pipfile
|
||||||
mediafiles
|
mediafiles
|
||||||
Pipfile.lock
|
Pipfile.lock
|
||||||
|
contributors.txt
|
||||||
|
|
15
coopeV3/management/commands/gencontributors.py
Normal file
15
coopeV3/management/commands/gencontributors.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
class Command(BaseCommand):
|
||||||
|
help = 'Generate the git contributors file'
|
||||||
|
|
||||||
|
def handle(self, *args, **options):
|
||||||
|
try:
|
||||||
|
subprocess.call("rm " + settings.BASE_DIR + "/contributors.txt", shell=True)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
subprocess.call("git -C " + settings.BASE_DIR + " shortlog -n $@ | grep \"):\" | sed 's|:||' >> " + settings.BASE_DIR + "/contributors.txt", shell=True)
|
||||||
|
subprocess.call("cat " + settings.BASE_DIR + "/contributors.txt", shell=True)
|
|
@ -44,14 +44,13 @@ def about(request):
|
||||||
"""
|
"""
|
||||||
A page about the project
|
A page about the project
|
||||||
"""
|
"""
|
||||||
os.system("git -C " + settings.BASE_DIR + " shortlog -n $@ | grep \"):\" | sed 's|:||' >> " + settings.BASE_DIR + "/contributors.txt")
|
|
||||||
contributors = []
|
contributors = []
|
||||||
with open(settings.BASE_DIR + "/contributors.txt", "r") as f:
|
try:
|
||||||
for line in f:
|
with open(settings.BASE_DIR + "/contributors.txt", "r") as f:
|
||||||
print(line)
|
for line in f:
|
||||||
print(line.split(" ")[0])
|
contributors.append((line[:line.find('(')], int(line[(line.find('(') + 1):line.find(')')])))
|
||||||
contributors.append((line.split(" ")[0], int(line.split(" ")[1].replace("(", "").replace(")", "").replace("\n", ""))))
|
except:
|
||||||
os.system("rm " + settings.BASE_DIR + "/contributors.txt")
|
pass
|
||||||
license = []
|
license = []
|
||||||
with open(settings.BASE_DIR + "/LICENSE", "r") as f:
|
with open(settings.BASE_DIR + "/LICENSE", "r") as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
(<a href="https://github.com/nanoy42/coope/blob/master/LICENSE" target="_blank">https://github.com/nanoy42/coope/blob/master/LICENSE</a>).
|
(<a href="https://github.com/nanoy42/coope/blob/master/LICENSE" target="_blank">https://github.com/nanoy42/coope/blob/master/LICENSE</a>).
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
Version 3.6.2.
|
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
<section id="third" class="main">
|
<section id="third" class="main">
|
||||||
|
@ -37,12 +35,16 @@
|
||||||
<h2>Contributeurs</h2>
|
<h2>Contributeurs</h2>
|
||||||
</header>
|
</header>
|
||||||
<section>
|
<section>
|
||||||
|
{% if contributors %}
|
||||||
Les contributeurs, triés par ordre décroissant de nombre de commits, sont:
|
Les contributeurs, triés par ordre décroissant de nombre de commits, sont:
|
||||||
<ol>
|
<ol>
|
||||||
{% for contributor in contributors %}
|
{% for contributor in contributors %}
|
||||||
<li>{{contributor.0}} ({{contributor.1}} commits)</li>
|
<li>{{contributor.0}} ({{contributor.1}} commits)</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ol>
|
</ol>
|
||||||
|
{% else %}
|
||||||
|
Impossible d'afficher la liste des contributeurs
|
||||||
|
{% endif %}
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue