Skip to content

Commit

Permalink
added pull code
Browse files Browse the repository at this point in the history
  • Loading branch information
utsengar committed Mar 31, 2012
1 parent 56841a3 commit 8f37912
Show file tree
Hide file tree
Showing 3 changed files with 1,200 additions and 0 deletions.
38 changes: 38 additions & 0 deletions git_actions.py
@@ -0,0 +1,38 @@
import os
from lib.gitstats import GitDataCollector

"""
>>> pull_project("utkarsh2012", "python-ebay")
"""

def pull_project(user_name, project):
os.system('git clone https://github.com/' + user_name + '/' + project + '.git')
project_dir = os.getcwd() + '/' + project
print project_dir

if os.path.exists(project_dir):
call_gitstats(project_dir)
else:
return "Git repo does not exist!"


def call_gitstats(project_folder):
data_collector = GitDataCollector()
data = data_collector.collect(project_folder)
_rm_rf(project_folder)
return data


def _rm_rf(d):
for path in (os.path.join(d, f) for f in os.listdir(d)):
if os.path.isdir(path):
_rm_rf(path)
else:
os.unlink(path)
os.rmdir(d)


if __name__ == "__main__":
pull_project("utkarsh2012", "python-ebay")
File renamed without changes.

0 comments on commit 8f37912

Please sign in to comment.