Created
November 20, 2009 23:04
-
-
Save spicycode/239859 to your computer and use it in GitHub Desktop.
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 | |
require 'rubygems' | |
require 'active_support' | |
require 'yaml' | |
require 'fileutils' | |
require 'pathname' | |
RootPath = Pathname.new('/Volumes/space/github_mirror') | |
GithubInfo = YAML.load_file(RootPath.join('the_parts_horror.yml')) | |
def make_with_the_awesome(*args) | |
command = args.join(' ') | |
if command.nil? | |
puts "No command given, just cloning any repos not already on disk" | |
end | |
FileUtils.cd(RootPath) do | |
GithubInfo.each do |username, repos| | |
repos.each do |repo| | |
repo_path = "#{username}-#{repo}" | |
if File.exist?(repo_path) | |
FileUtils.cd(repo_path) do | |
ICommandTheeTo command, repo_path | |
end | |
else | |
clone_url = "git://github.com/#{username}/#{repo}.git" | |
ICommandTheeTo "git clone #{clone_url} #{repo_path}" | |
end | |
end | |
end | |
end | |
end | |
def ICommandTheeTo(command, repo_path=nil) | |
return if command.blank? | |
path = repo_path ? " in #{repo_path}" : nil | |
puts "Executing '#{command}'#{path}" | |
puts '-' * 40 | |
system command | |
puts | |
end | |
make_with_the_awesome(ARGV) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment