Change nuget-resilient-publish to allow specifying a path to nuget.exe.

This commit is contained in:
Pranav K 2015-06-29 15:21:23 -07:00
parent 6d5ac18d0c
commit bd2025c561
1 changed files with 17 additions and 3 deletions

View File

@ -12,11 +12,25 @@ nugetFeed=''
Required. Feed to publish to.
*/}
default apiKey='${Environment.GetEnvironmentVariable("APIKEY")}'
default extra=''
var nugetArgs=''
set nugetArgs='${nugetArgs} -ApiKey ${apiKey}' if='!string.IsNullOrEmpty(apiKey)'
set nugetArgs='${nugetArgs} -Source ${nugetFeed}' if='!string.IsNullOrEmpty(nugetFeed)'
set nugetArgs='${nugetArgs} ${extra}' if='!string.IsNullOrEmpty(extra)'
@{
var packages = Directory.EnumerateFiles(sourcePackagesDir, "*.nupkg")
.Where(p => !p.EndsWith(".symbols.nupkg"))
.ToArray();
var nugetExePath = Environment.GetEnvironmentVariable("PUSH_NUGET_EXE");
if (string.IsNullOrEmpty(nugetExePath))
{
nugetExePath = ".nuget/NuGet.exe";
}
Parallel.ForEach(packages, package =>
{
var retries = 0;
@ -24,7 +38,7 @@ nugetFeed=''
start:
try
{
NuGetPush (nugetFeed, packagePath, "");
ExecClr(nugetExePath, "push " + package + " " + nugetArgs);
}
catch
{
@ -38,5 +52,5 @@ nugetFeed=''
});
}
macro name='NuGetPush' source='string' nupkgFile='string' extra='string'
nuget-push
macro name='ExecClr' program='string' commandline='string'
exec-clr