Created
June 15, 2010 22:03
-
-
Save tomz/439811 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 | |
# script to refresh local git or svn repos | |
def pull_or_update (level = 1) | |
if (level > 0) | |
Dir.glob("*").each {|e| | |
Dir.chdir(e) do | |
if File.directory?(".git") | |
puts "\n========== pulling #{e} ==========" | |
system 'git pull' | |
elsif File.directory?(".svn") | |
puts "\n========== updating #{e} ==========" | |
system 'svn update' | |
else | |
pull_or_update(level-1) | |
end | |
end if File.directory?(e) | |
} | |
end | |
end | |
level = ARGV[0] || 2 # default to 2 levels down | |
pull_or_update level |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment