Skip to content

Instantly share code, notes, and snippets.

@indirect
Created July 30, 2010 23:40
Show Gist options
  • Save indirect/501501 to your computer and use it in GitHub Desktop.
Save indirect/501501 to your computer and use it in GitHub Desktop.
check out every repo from plexinc-plugins and plexinc-agents
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