Created
November 6, 2014 17:22
-
-
Save coolacid/0056bf9ffad1e4e2b636 to your computer and use it in GitHub Desktop.
Pull all Logstash-Plugins
This file contains hidden or 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/env python | |
from pygithub3 import Github | |
from subprocess import call | |
import os | |
gh = Github() | |
#es = gh.orgs.get('elasticsearch') | |
repos = gh.repos.list_by_org('logstash-plugins') | |
for repo in repos.all(): | |
print "https://github.com/%s.git" % repo.full_name | |
path = os.path.join(os.getcwd(), repo.name) | |
if os.path.exists(path) and os.path.isdir(path): | |
pwd = os.getcwd() | |
os.chdir(path) | |
call(["git", "pull"]) | |
os.chdir(pwd) | |
elif not os.path.exists(path): | |
call(["git", "clone", "https://github.com/%s.git" % repo.full_name]) | |
elif os.path.exists(path) and not os.path.isdir(path): | |
print "------------> File exists with repo name <----------------" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment