Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Bug 694796 - add localizers to humans.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
netoarmando committed Feb 25, 2013
1 parent bdedf38 commit bcd7180
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions apps/humans/models.py
@@ -1,6 +1,7 @@
import json
import urllib
from django.conf import settings
import subprocess

GITHUB_REPOS = "https://api.github.com/repos/mozilla/kuma/contributors"

Expand All @@ -14,20 +15,23 @@ def __init__(self):
class HumansTXT:
def generate_file(self):
githubbers = self.get_github(json.load(urllib.urlopen(GITHUB_REPOS)))
localizers = self.get_mdn()

target = open("%s/humans.txt" % settings.HUMANSTXT_ROOT, 'w')

self.write_to_file(githubbers, target, "Contributors on Github")
self.write_to_file(githubbers, target, "Contributors on Github", "Developer")
self.write_to_file(localizers, target, "Localization Contributors", "Localizer")

target.close()

def write_to_file(self, humans, target, message):
def write_to_file(self, humans, target, message, role):
target.write("%s \n" % message)
for h in humans:
target.write("Developer: %s \n" % h.name.encode('ascii', 'ignore'))
target.write("%s: %s \n" % (role, h.name.encode('ascii', 'ignore')))
if(h.website != None):
target.write("Website: %s \n" % h.website)
target.write('\n')
target.write('\n')
target.write('\n')

def get_github(self, data=None):
if not data:
Expand All @@ -51,3 +55,15 @@ def get_github(self, data=None):
humans.append(human)

return humans

def get_mdn(self):
p = subprocess.Popen("svn log --quiet http://svn.mozilla.org/projects/mdn/trunk/locale/ | grep '^r' | awk '{print $3}' | sort | uniq",shell=True,stdout=subprocess.PIPE)
localizers_list = p.communicate()[0].rstrip().split('\n', -1)

humans = []
for localizer in localizers_list:
human = Human()
human.name = localizer
humans.append(human)

return humans

0 comments on commit bcd7180

Please sign in to comment.