class Object

Public Instance Methods

traverse(filePath) click to toggle source

TODO:文件目录校验 .git,遍历目录下所有的.git库全部更新

# File lib/update_gitrepos.rb, line 34
def traverse(filePath)
  gitReposArray = Array.new
  if File.directory?(filePath)
    Dir.foreach(filePath) do |fileName|
      if File.directory?(filePath + "/" + fileName) and fileName != "." and fileName != ".."
        gitReposArray << (filePath + "/" + fileName)
      end
    end
  else
    puts "Files:" + filePath
  end
  return gitReposArray
end
updateRepos(gitReposArray) click to toggle source
# File lib/update_gitrepos.rb, line 48
def updateRepos(gitReposArray)
  gitReposArray.prog_each { 
    |repoPath|
    system("echo \n" )
    system("echo Begin update git repo:#{repoPath} \n cd #{repoPath} \n git pull")
  }
end