Last active
August 29, 2015 14:19
-
-
Save vaskaloidis/70d63d0d69cbfe9a13c7 to your computer and use it in GitHub Desktop.
Python Script to Git Clone each Apelon-VA ISAAC + OCHRE Framework
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
#! /usr/bin/python | |
# | |
# Pull each Apelon-VA Repo | |
# | |
import subprocess | |
import os | |
def git(*args): | |
return subprocess.Popen(['git'] + list(args), shell=True, stdout=subprocess.PIPE).communicate()[0] | |
projects = ['va-isaac-parent', 'va-ochre', 'va-isaac-metadata', 'va-isaac-mojo', 'va-newtons-cradle', 'va-logic', 'va-query-service', 'va-solor-goods', 'va-isaac-gui', 'va-expression-service'] | |
for project in projects: | |
repoUrl = "https://github.com/Apelon-VA/" + project + ".git" | |
gitArgs = ['git', 'clone', repoUrl] | |
print("Attempting to clone: " + repoUrl) | |
print("GIT Command: ") | |
print(list(gitArgs)) | |
output = subprocess.Popen(gitArgs, shell=True, stdout=subprocess.PIPE).communicate()[0] | |
# output = git("clone", repoUrl) | |
# TODO: What is printed when a Git Clone fails, add that to L21 | |
if "usage: git [--version]" in output: | |
print("GIT COMMAND PROBLEM. Fix the Git Command") | |
print(output) | |
elif "git error" in output: | |
print("GIT ERROR") | |
print("GIT ERROR!") | |
if output: | |
print(output) | |
raise Exception("GIT ERROR!") | |
else: | |
print("GIT SUCCESS!") | |
print(output) | |
output = None | |
break | |
# Add a hook at the end of the loop to manually create a Eclipse Project in the .project file and import these repos... dope | |
os.chdir(os.pardir) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment