Skip to content

Instantly share code, notes, and snippets.

@VladimirWrites
Last active April 11, 2018 20:21
preBuild.doFirst {
def samplesDir = new File(projectDir.absolutePath, "sampledata")
if (samplesDir.exists()) {
return
}
samplesDir.mkdir()
def files = ["lotr.json", "starwars.json"] //list of sample files that need to be downloaded
for(fileName in files) {
def names = new File(samplesDir, fileName)
new URL("https://raw.githubusercontent.com/VladimirWrites/tools-sample/master/sampledata/$fileName").withInputStream { i ->
names.withOutputStream {
it << i
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment