Skip to content

Instantly share code, notes, and snippets.

@coolacid
Created November 6, 2014 17:22
Show Gist options
  • Save coolacid/0056bf9ffad1e4e2b636 to your computer and use it in GitHub Desktop.
Save coolacid/0056bf9ffad1e4e2b636 to your computer and use it in GitHub Desktop.
Pull all Logstash-Plugins
#!/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