Add command for building all git_stats directories

This just builds each one with a subprocess call and then creates an
index page you I can easily navigate between them
This commit is contained in:
Eli Ribble 2015-07-23 13:00:40 -06:00
parent d725de6949
commit b34482bcfd
3 changed files with 45 additions and 0 deletions

35
bin/build-stats Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env python
import argparse
import jinja2
import os
import subprocess
import teamanalysis.git
import teamanalysis.repos
import webbrowser
def _git_stats(abspath):
output = subprocess.check_output(['git_stats', 'generate', '--path=' + abspath, '--out-path=' + os.path.join(abspath, 'git_stats')])
return output
def main():
for repo in teamanalysis.repos.REPOSITORIES:
print(repo)
abspath = '/Users/eliribble/src/{}/'.format(repo)
#output = _git_stats(abspath)
template_loader = jinja2.FileSystemLoader(searchpath=os.path.abspath('./templates/'))
template_environment = jinja2.Environment(loader=template_loader)
template = template_environment.get_template('git_stats.html')
output = template.render(repos=teamanalysis.repos.REPOSITORIES)
try:
os.mkdir('git_stats')
except OSError:
pass
with open('git_stats/index.html', 'w') as f:
f.write(output)
webbrowser.open(os.path.abspath('./git_stats/index.html'))
if __name__ == '__main__':
main()

View File

@ -76,6 +76,7 @@ def main():
author = "Eli Ribble", author = "Eli Ribble",
author_email = "eli@theribbles.org", author_email = "eli@theribbles.org",
install_requires = [ install_requires = [
'Jinja2==2.7.3',
], ],
packages = ['teamanalysis'], packages = ['teamanalysis'],
package_data = { package_data = {

9
templates/git_stats.html Normal file
View File

@ -0,0 +1,9 @@
<html>
<body>
<ul>
{% for repo in repos %}
<li><a href="/Users/eliribble/src/{{ repo }}/git_stats/index.html">{{ repo }}</a></li>
{% endfor %}
</ul>
</body>
</html>