Created
November 26, 2015 18:48
-
-
Save caarlos0/6c177192fd825a235534 to your computer and use it in GitHub Desktop.
Clone all repositories in any given organization.
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
# clone-all-org-repos.rb | |
# | |
# Clone all repositories in any given organization. | |
# | |
# Dependencies: | |
# - octokit | |
# - celluloid | |
# | |
# Usage: | |
# TOKEN="your-token" ruby clone-all-org-repos.rb TheOrganizationName | |
# | |
require 'octokit' | |
require 'celluloid/current' | |
client = Octokit::Client.new( | |
access_token: ENV['TOKEN'], | |
auto_traversal: true, | |
auto_paginate: true | |
) | |
organization = ARGV[0] | |
puts "Cloning #{organization}..." | |
futures = [] | |
client.org_repos(organization).map do |repo| | |
futures << Celluloid::Future.new { `git clone #{repo.ssh_url}` } | |
end | |
futures.each { |f| puts f.value } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment