Last active
August 29, 2015 14:03
-
-
Save gravitylow/f0967bca841d81e95a05 to your computer and use it in GitHub Desktop.
Ten.Java Gource Creator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I'm not a python developer | |
import json | |
import urllib | |
import urllib2 | |
from subprocess import call | |
url = "https://tenjava.com/api/participants?repos=1"; | |
devnull = open('/dev/null', 'w') | |
def collect(): | |
data = json.load(urllib2.urlopen(url)) | |
for i in range(0, len(data)): | |
name = data[i]["gh_username"].lower(); | |
entry = data[i]["time_entry"]; | |
print "Collecting data from {} user {}/{}".format(name, i+1, len(data)) | |
for time in entry: | |
if entry[time] is 1: | |
repo = name + "-" + time | |
collect_user(repo) | |
def collect_user(repo): | |
execute("git clone git@github.com:tenjava/{}.git".format(repo)) | |
execute("gource --output-custom-log {}.txt {}".format(repo, repo)) | |
execute("sed -i -r \"s#(.+)\|#\\1|/{}#\" {}.txt".format(repo, repo)) | |
def execute(c): | |
call(c, shell=True, stdout=devnull, stderr=devnull) | |
collect() | |
print "Combining all user data.." | |
execute("cat *.txt | sort -n > combined.txt") | |
print "Output: combined.txt" | |
print "To view: gource -f 1280x720 --hide filenames,dirnames --disable-bloom combined.txt --hide-root" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment