Created
November 16, 2012 02:47
-
-
Save weisjohn/4083500 to your computer and use it in GitHub Desktop.
clone all my repos using the Github API
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
var request = require('request'), | |
u = require('underscore') | |
exec = require('child_process').exec, | |
child = null, | |
repos = null; | |
request('https://api.github.com/users/weisjohn/repos', function (error, response, body) { | |
if (!error && response.statusCode == 200) { | |
// grab all the repos from github | |
repos = JSON.parse(body); | |
// retrive the ssh locations, process them one by one | |
var urls = u.pluck(repos, 'ssh_url'); | |
u.each(urls, function(ssh_url) { | |
child = exec('git clone ' + ssh_url, function (error, stdout, stderr) { | |
console.log(stdout); | |
console.error(stderr); | |
if (error !== null) { | |
console.log('exec error: ' + error); | |
} | |
}); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment