Created
July 22, 2009 01:05
-
-
Save spicycode/151732 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
ICommandTheTo command, repo_path | |
end | |
else | |
clone_url = "git://github.com/#{username}/#{repo}.git" | |
ICommandTheTo "git clone #{clone_url} #{repo_path} --quiet" | |
end | |
end | |
end | |
end | |
end | |
def ICommandTheTo(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) |
This file contains hidden or 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
# Now you can just run it to clone all the defined repos: | |
ruby clonus.rb | |
# Want to update? | |
ruby clonus.rb git pull | |
# Arbitrary command? | |
ruby clonus.rb ls -l |
This file contains hidden or 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
--- | |
280north: | |
- aristo | |
actionrails: | |
- modporter | |
ahoward: | |
- main | |
- testy | |
alloy: | |
- kicker |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment