Created
July 30, 2010 23:40
-
-
Save indirect/501501 to your computer and use it in GitHub Desktop.
check out every repo from plexinc-plugins and plexinc-agents
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
require 'rubygems' | |
require 'open-uri' | |
require 'json' | |
def repo_page(username, page_num = 1) | |
url = "http://github.com/api/v2/json/repos/show/#{username}?page=#{page_num}" | |
JSON.parse(open(url).read)["repositories"] | |
end | |
def repo_urls(username) | |
urls = [] | |
page_num = 1 | |
next_page = repo_page(username, page_num) | |
until next_page.empty? | |
urls += next_page.map{|r| r["url"] } | |
page_num += 1 | |
next_page = repo_page(username, page_num) | |
end | |
urls | |
end | |
%w(plexinc-plugins plexinc-agents).each do |d| | |
FileUtils.mkdir_p(d) | |
Dir.chdir(d) do | |
repo_urls(d).each do |u| | |
`git clone #{u.gsub('https://github.com/', 'git@github.com:')}` | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment