Created
December 5, 2014 03:35
-
-
Save mgarciaisaia/46d0fb26c48746eb53c7 to your computer and use it in GitHub Desktop.
Locally clone all repos from a BitBucket team
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/env ruby | |
# USAGE: ./clone ORG_NAME | |
# ( ./clone instedd ) | |
require 'open-uri' | |
require 'json' | |
team = ARGV[0] || raise("Must specify organization name") | |
puts "Fetching https://bitbucket.org/!api/1.0/users/#{team}..." | |
data = JSON.parse(open("https://bitbucket.org/!api/1.0/users/#{team}").read) | |
data["repositories"].each do | repo | | |
# delete "echo" for _actually_ cloning them | |
system("echo #{repo["scm"]} clone https://bitbucket.org/#{team}/#{repo["slug"]}") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment