Created
June 7, 2013 05:22
-
-
Save akhikhl/5727210 to your computer and use it in GitHub Desktop.
Batch pull on all git-repositories found in the current folder
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
buildscript { | |
repositories { mavenCentral() } | |
dependencies { classpath 'org.ajoberstar:gradle-git:0.5.0' } | |
} | |
import org.ajoberstar.gradle.git.tasks.* | |
def onEachGitFolder(File folder, Closure closure) { | |
File gitServiceFolder = new File(folder, ".git") | |
if(gitServiceFolder.exists() && gitServiceFolder.isDirectory()) | |
closure(folder) | |
else | |
folder.eachDir { subFolder -> | |
onEachGitFolder(subFolder, closure); | |
} | |
} | |
task pull | |
onEachGitFolder projectDir, { folder -> | |
def taskName = folder.name + "_pull" | |
project.task (taskName, type: GitPull) { | |
setRepoPath folder.absolutePath | |
} | |
project.tasks.pull.dependsOn project.tasks[taskName] | |
} | |
defaultTasks "pull" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment