Created
February 4, 2011 12:38
-
-
Save jeremywrowe/811065 to your computer and use it in GitHub Desktop.
update all of your git and svn projects from a root directory
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/ruby | |
require 'fileutils' | |
include FileUtils | |
here = File.expand_path(File.dirname(__FILE__)) | |
git_dirs = Dir.glob("#{here}/*/.git") | |
svn_dirs = Dir.glob("#{here}/*/.svn") | |
def git_pull(path) | |
cd path | |
`git pull` | |
end | |
def svn_update(path) | |
cd path | |
`svn update` | |
end | |
puts "Performing a GIT pull.." if git_dirs.size > 0 | |
git_dirs.each do |git_dir| | |
path = git_dir.sub!(/\.git/, "") | |
puts "Pulling from: #{path}" | |
git_pull path | |
end | |
puts "Performing a SVN update.." if svn_dirs.size > 0 | |
svn_dirs.each do |svn_dir| | |
path = svn_dir.sub!(/\.svn/, "") | |
puts "Updating #{path}" | |
svn_update path | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment