Skip to content

Instantly share code, notes, and snippets.

@ataylor284
Created July 31, 2017 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ataylor284/c072c34347393a0aec350fdfa581a527 to your computer and use it in GitHub Desktop.
Save ataylor284/c072c34347393a0aec350fdfa581a527 to your computer and use it in GitHub Desktop.
[nxrm] populate repository with nuget packages
import java.nio.file.Files
import static groovyx.gpars.GParsPool.withPool
def N_PACKAGES = 100
withPool {
(0..<N_PACKAGES).eachParallel { i ->
def dir = new File("package_$i")
dir.deleteDir()
dir.mkdir()
new File("package_$i/Package.nuspec") <<
"""\
|<?xml version="1.0"?>
|<package>
| <metadata>
| <id>Redtoad.Test$i</id>
| <version>1.0.0</version>
| <authors>ataylor</authors>
| <owners>ataylor</owners>
| <projectUrl>https://github.com/ataylor284/nuget-test$i</projectUrl>
| <requireLicenseAcceptance>false</requireLicenseAcceptance>
| <description>Nuget package test</description>
| <releaseNotes>Initial release.</releaseNotes>
| <copyright>Copyright 2016</copyright>
| <tags>Test Nuget</tags>
| </metadata>
| <files>
| <file src="README.md" target="README.md" />
| <file src="payload*" target="payloads" />
| </files>
|</package>
|""".stripMargin()
Files.copy(new File("README.md").toPath(), new File("package_$i/README.md").toPath())
(0..9).each { f ->
new File("package_$i/payload$f") << "payload$f"
}
"nuget pack".execute(null, dir).waitForProcessOutput(System.out, System.err)
"nuget push -Source local Redtoad.Test$i.1.0.0.nupkg".execute(null, dir).waitForProcessOutput(System.out, System.err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment