ProcessArgumentBuilder

Namespace: Cake.Core
We found 10 examples in language CSharp for this search. You will see 30 fragments of code.
//////////////////////////////////////////////////////////////////////
// TOOLS
//////////////////////////////////////////////////////////////////////

using Path = System.IO.Path;
using IO = System.IO;
using System.Text.RegularExpressions;
using Cake.Common.Tools;

//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");

///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////
var localPackagesDir = "../LocalPackages";
var buildDir = @".\build";
var unpackFolder = Path.Combine(buildDir, "temp");
var unpackFolderFullPath = Path.GetFullPath(unpackFolder);
var artifactsDir = @".\artifacts";
var files = new string[] { "AWSCLI64.msi", "AWSCLI32.msi" };
var file = string.Empty;
var nugetVersion = string.Empty;
var nugetPackageFile = string.Empty;

///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////
Setup(context =>
{
    
});

Teardown(context =>
{
    Information("Finished running tasks.");
});

//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////

Task("Clean")
    .Does(() =>
{
    CleanDirectory(buildDir);
    CleanDirectory(unpackFolder);
    CleanDirectory(artifactsDir);
});

// Task("Restore-NuGet-Packages")
//     .IsDependentOn("Clean")
//     .Does(() =>
// {
//     NuGetRestore("./src/Example.sln");
// });

Task("Restore-Source-Package")
    .IsDependentOn("Clean")
    .Does(() => 
{
    var outputPath = File($"{buildDir}/{file}");
    var url = $"https://s3.amazonaws.com/aws-cli/{file}";
    Information($"Downloading {url}");
    DownloadFile(url, outputPath);
});

Task("Unpack-Source-Package")
    .IsDependentOn("Restore-Source-Package")
    .IsDependentOn("Clean")
    .Does(() => 
{
    var sourcePackage = file;
    
    Information($"Unpacking {sourcePackage}");
    
    var processArgumentBuilder = new ProcessArgumentBuilder();
    processArgumentBuilder.Append($"/a {sourcePackage}");
    processArgumentBuilder.Append("/qn");
    processArgumentBuilder.Append($"TARGETDIR={unpackFolderFullPath}");
    var processSettings = new ProcessSettings { Arguments = processArgumentBuilder, WorkingDirectory = buildDir };
    StartProcess("msiexec.exe", processSettings);
    Information($"Unpacked {sourcePackage} to {unpackFolderFullPath}");
});

Task("GetVersion")
    .IsDependentOn("Unpack-Source-Package")
    .Does(() => 
{
    Information("Determining version number");
    Information(System.IO.Directory.GetCurrentDirectory());

    var cliDir = Path.Combine(unpackFolderFullPath, "Amazon", "AWSCLI");
    //Information(cliDir);
    var processArgumentBuilder = new ProcessArgumentBuilder();
    processArgumentBuilder.Append("--version");
    var processSettings = new ProcessSettings 
                            { 
                                Arguments = processArgumentBuilder, 
                                WorkingDirectory = Directory(cliDir), 
                                RedirectStandardOutput = true,
                                RedirectStandardError = true
                            };
    IEnumerable<string> standardOutput;
    IEnumerable<string> errorOutput;

    StartProcess(Path.Combine(cliDir, "aws.exe"), processSettings, out standardOutput, out errorOutput);
    var outputLine = errorOutput.First();
    Information($"Version output is \"{outputLine}\"");
    var regexMatch = Regex.Match(outputLine, @"aws-cli\/(?<Version>[\d\.]*)");
    nugetVersion = regexMatch.Groups["Version"].Value;
    Information($"Calculated version number: {nugetVersion}");

    if(BuildSystem.IsRunningOnTeamCity)
        BuildSystem.TeamCity.SetBuildNumber(nugetVersion);
});

Task("Pack")
    .IsDependentOn("GetVersion")
    .Does(() =>
{
    var fileWithoutExtension = Path.GetFileNameWithoutExtension(file);
    Information($"Building Octopus.Dependencies.{fileWithoutExtension} v{nugetVersion}");
    
    NuGetPack("awscli.nuspec", new NuGetPackSettings {
        BasePath = unpackFolder,
        OutputDirectory = artifactsDir,
        ArgumentCustomization = args => args.Append($"-Properties \"version={nugetVersion};subpackagename={fileWithoutExtension}\"")
    });
});

Task("Publish")
    .WithCriteria(BuildSystem.IsRunningOnTeamCity)
    .IsDependentOn("Pack")
    .Does(() => 
{
    var fileWithoutExtension = Path.GetFileNameWithoutExtension(file);
    NuGetPush($"{artifactsDir}/Octopus.Dependencies.{fileWithoutExtension}.{nugetVersion}.nupkg", new NuGetPushSettings {
        Source = "https://f.feedz.io/octopus-deploy/dependencies/nuget",
        ApiKey = EnvironmentVariable("FeedzIoApiKey")
    });
});

Task("CopyToLocalPackages")
    .WithCriteria(BuildSystem.IsLocalBuild)
    .IsDependentOn("Pack")
    .Does(() => 
{
    var fileWithoutExtension = Path.GetFileNameWithoutExtension(file);
    CreateDirectory(localPackagesDir);
    CopyFileToDirectory(Path.Combine(artifactsDir, $"Octopus.Dependencies.{fileWithoutExtension}.{nugetVersion}.nupkg"), localPackagesDir);
});


//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////

Task("FullChain")
    .IsDependentOn("Clean")
    .IsDependentOn("Restore-Source-Package")
    .IsDependentOn("Unpack-Source-Package")
    .IsDependentOn("GetVersion")
    .IsDependentOn("Pack")
    .IsDependentOn("Publish")
    .IsDependentOn("CopyToLocalPackages");

Task("Default").Does(() => 
{  
    foreach (var f in files)
    {
        file = f;
        RunTarget("FullChain");
    }
});

//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////

RunTarget(target);

        public static ProcessArgumentBuilder AppendOnOffIfBooleanHasValue(this ProcessArgumentBuilder builder, string text, bool? boolean)
        {
            if (!boolean.HasValue)
            {
                return builder;
            }

            return builder.Append($"{text} {boolean.Value.ToStringOnOff()}");
        }

        public static ProcessArgumentBuilder AppendQuotedSecretUnlessNullWhitespaceOrEmpty(this ProcessArgumentBuilder builder, string argument, string value)
        {
            if (string.IsNullOrWhiteSpace(value))
            {
                return builder;
            }

            return builder.Append(argument).AppendQuotedSecret(value);
        }

        public static ProcessArgumentBuilder AppendQuotedSecretUnlessNullWhitespaceOrEmpty(this ProcessArgumentBuilder builder, string text)
        {
            if (string.IsNullOrWhiteSpace(text))
            {
                return builder;
            }

            return builder.AppendQuotedSecret(text);
        }

        public static ProcessArgumentBuilder AppendQuotedUnlessNullWhitespaceOrEmpty(this ProcessArgumentBuilder builder, string text)
        {
            if (string.IsNullOrWhiteSpace(text))
            {
                return builder;
            }

            return builder.AppendQuoted(text);
        }

        public static ProcessArgumentBuilder AppendQuotedUnlessNullWhitespaceOrEmpty(this ProcessArgumentBuilder builder, string argument, string value)
        {
            if (string.IsNullOrWhiteSpace(value))
            {
                return builder;
            }

            return builder.Append(argument).AppendQuoted(value);
        }

        public static ProcessArgumentBuilder AppendUnlessNullWhitespaceOrEmpty(this ProcessArgumentBuilder builder, string text)
        {
            if (string.IsNullOrWhiteSpace(text))
            {
                return builder;
            }

            return builder.Append(text);
        }

var npmPath = (IsRunningOnWindows()
                ? Context.Tools.Resolve("npm.cmd")
                : Context.Tools.Resolve("npm"))
                ?? throw new Exception("Failed to resolve npm, make sure Node is installed.");

Action<FilePath, ProcessArgumentBuilder> Cmd => (path, args) => {
    var result = StartProcess(path, new ProcessSettings { Arguments = args });

    if(0 != result)
    {
        throw new Exception($"Failed to execute tool {path.GetFilename()} ({result})");
    }
};

Task("Build")
    .Does(() => DotNetCoreRun("ConsulenzaWeb.csproj"));

Task("Install-Netlify-Cli")
    .Does(() => Cmd(npmPath, new ProcessArgumentBuilder()
        .Append("install")
        .Append("netlify-cli")));

Task("Deploy")
    .IsDependentOn("Build")
    .IsDependentOn("Install-Netlify-Cli")
    .Does(() => {
        var netlifyPath = (IsRunningOnWindows()
            ? Context.Tools.Resolve("netlify.cmd")
            : Context.Tools.Resolve("netlify"))
            ?? throw new Exception("Failed to resolve netlify-cli, make sure netlify-cli is installed.");

        Cmd(netlifyPath, new ProcessArgumentBuilder()
            .Append("deploy")
            .AppendSwitch("--dir", "=", "output")
            .Append("--prod"));
    });

Task("Preview")
    .Does(() => DotNetCoreRun("ConsulenzaWeb.csproj", new ProcessArgumentBuilder()
        .Append("preview")));

Task("Default")
    .IsDependentOn("Build");

RunTarget(Argument("Target", "Default"));

        public static ProcessArgumentBuilder AppendNonEmptySwitch(this ProcessArgumentBuilder builder, string @switch, string text)
        {
            return string.IsNullOrWhiteSpace(text) == false ? builder.AppendSwitch(@switch, text) : builder;
        }

        public static ProcessArgumentBuilder AppendNonEmptyQuotedSwitch(this ProcessArgumentBuilder builder, string @switch, string text)
        {
            return string.IsNullOrWhiteSpace(text) == false ? builder.AppendSwitchQuoted(@switch, text) : builder;
        }

        public static ProcessArgumentBuilder AppendNonEmptySecretSwitch(this ProcessArgumentBuilder builder, string @switch, string text)
        {
            return string.IsNullOrWhiteSpace(text) == false ? builder.AppendSwitchQuotedSecret(@switch, text) : builder;
        }

        public static ProcessArgumentBuilder AppendNonNullFilePathSwitch(this ProcessArgumentBuilder builder, string @switch, FilePath filePath, ICakeEnvironment environment)
        {
            return filePath == null ? builder : builder.AppendSwitchQuoted(@switch, filePath.MakeAbsolute(environment).FullPath);
        }
        public static ProcessArgumentBuilder AppendNonNullRelativeFilePathSwitch(this ProcessArgumentBuilder builder, string @switch, FilePath filePath, ICakeEnvironment environment)
        {
            return filePath == null ? builder : builder.AppendSwitchQuoted(@switch, filePath.FullPath);
        }
        public static ProcessArgumentBuilder AppendNonNullDirectoryPathSwitch(this ProcessArgumentBuilder builder, string @switch, DirectoryPath directoryPath, ICakeEnvironment environment)
        {
            return directoryPath == null ? builder : builder.AppendSwitchQuoted(@switch, directoryPath.MakeAbsolute(environment).FullPath);
        }

        internal static ProcessArgumentBuilder AppendMSBuildProperty(this ProcessArgumentBuilder builder, string propertyName, string value)
        {
            builder.AppendSwitch($"/property:{propertyName}", "=", value);
            return builder;
        }

        internal static ProcessArgumentBuilder AppendMSBuildPropertyQuoted(this ProcessArgumentBuilder builder, string propertyName, string value)
        {
            builder.AppendSwitchQuoted($"/property:{propertyName}", "=", value);
            return builder;
        }

        internal static ProcessArgumentBuilder AppendPropertyList(this ProcessArgumentBuilder builder, string propertyName, IEnumerable<string> values)
        {
            builder.Append($"/property:{propertyName}=\\\"{string.Join(",", values.Select(s => s.Trim()))}\\\"");
            return builder;
        }

        internal static ProcessArgumentBuilder AppendSwitchQuoted(this ProcessArgumentBuilder builder, string @switch, IEnumerable<string> values)
        {
            foreach (var type in values.Select(s => s.Trim()))
            {
                builder.AppendSwitchQuoted(@switch, type);
            }
            return builder;
        }

        internal static ProcessArgumentBuilder AppendSwitch(this ProcessArgumentBuilder builder, string @switch, IEnumerable<string> values)
        {
            foreach (var type in values.Select(s => s.Trim()))
            {
                builder.AppendSwitch(@switch, type);
            }
            return builder;
        }


var npmPath = (IsRunningOnWindows()
                ? Context.Tools.Resolve("npm.cmd")
                : Context.Tools.Resolve("npm"))
                ?? throw new Exception("Failed to resolve npm, make sure Node is installed.");

Action<FilePath, ProcessArgumentBuilder> Cmd => (path, args) => {
    var result = StartProcess(path, new ProcessSettings { Arguments = args });

    if(0 != result)
    {
        throw new Exception($"Failed to execute tool {path.GetFilename()} ({result})");
    }
};

Task("Build")
    .Does(() => DotNetCoreRun("./src/site.csproj"));

Task("Install-Netlify-Cli")
    .Does(() => Cmd(npmPath, new ProcessArgumentBuilder()
        .Append("install")
        .AppendSwitch("--prefix", " ", "tools")
        .Append("netlify-cli")));

Task("Deploy")
    .IsDependentOn("Build")
    .IsDependentOn("Install-Netlify-Cli")
    .Does(() => {
        var netlifyPath = (IsRunningOnWindows()
            ? Context.Tools.Resolve("netlify.cmd")
            : Context.Tools.Resolve("netlify"))
            ?? throw new Exception("Failed to resolve netlify-cli, make sure netlify-cli is installed.");

        Cmd(netlifyPath, new ProcessArgumentBuilder()
            .Append("deploy")
            .AppendSwitch("--dir", "=", "output"));
    });

Task("Preview")
    .Does(() => DotNetCoreRun("./src/site.csproj", new ProcessArgumentBuilder()
        .Append("preview")));

Task("Default")
    .IsDependentOn("Build");

RunTarget(Argument("Target", "Default"));

#addin "Cake.Docker"
#addin "Cake.FileHelpers"

#load "config.cake"

using System.Text.RegularExpressions;

var target = Argument("target", "Pack");
var buildConfiguration = Argument("Configuration", "Release");

using System.Net;
using System.Net.Sockets;

// var adapter = NetworkInformation.NetworkInterface.GetAllNetworkInterfaces().FirstOrDefault(i => i.Name == "Wi-Fi");
// var properties = adapter.GetIPProperties();

string localIpAddress;
using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0))
{
    socket.Connect("8.8.8.8", 65530);
    var endPoint = socket.LocalEndPoint as IPEndPoint;
    localIpAddress = endPoint.Address.ToString();
}

var dockerRepositoryProxy = EnvironmentVariable("DOCKER_REPOSITORY_PROXY") ?? $"mcr.microsoft.com";
var dockerRepository = EnvironmentVariable("DOCKER_REPOSITORY") ?? string.Empty;
var dockerRepositoryUsername = EnvironmentVariable("DOCKER_REPOSITORY_USERNAME") ?? string.Empty;
var dockerRepositoryPassword = EnvironmentVariable("DOCKER_REPOSITORY_PASSWORD") ?? string.Empty;

var nugetRepositoryProxy = EnvironmentVariable("NUGET_REPOSITORY_PROXY") ?? $"https://api.nuget.org/v3/index.json";
var nugetRepository = EnvironmentVariable("NUGET_REPOSITORY");
var nugetApiKey = EnvironmentVariable("NUGET_API_KEY");

var DockerRepositoryPrefix = string.IsNullOrWhiteSpace(dockerRepository) ? string.Empty : dockerRepository + "/";


Task("UpdateVersion")
  .Does(() => 
  {
      StartProcess("dotnet", new ProcessSettings
      {
          Arguments = new ProcessArgumentBuilder()
            .Append("gitversion")
            .Append("/output")
            .Append("buildserver")
            .Append("/nofetch")
            .Append("/updateassemblyinfo")
      });

      IEnumerable<string> redirectedStandardOutput;
      StartProcess("dotnet", new ProcessSettings
      {
          Arguments = new ProcessArgumentBuilder()
            .Append("gitversion")
            .Append("/output")
            .Append("json")
            .Append("/nofetch"),
          RedirectStandardOutput = true
      }, out redirectedStandardOutput);

      NuGetVersionV2 = redirectedStandardOutput.FirstOrDefault(s => s.Contains("NuGetVersionV2")).Split(':')[1].Trim(',', ' ', '"');

      System.Xml.XmlDocument pomDocument = new System.Xml.XmlDocument();
      pomDocument.Load("pom.xml");
      pomDocument.DocumentElement["version"].InnerText = NuGetVersionV2;
      pomDocument.Save("pom.xml");
});

Task("Restore")
  .Does(() => 
	{
	      StartProcess("mvn", new ProcessSettings
	      {
	          Arguments = new ProcessArgumentBuilder()
	          .Append("dependency:resolve")
	      });
	});

Task("Build")
  .IsDependentOn("UpdateVersion")
  .IsDependentOn("Restore")
  .Does(() => 
	{
		EnsureDirectoryExists("target");
		CleanDirectory("target");
		
		EnsureDirectoryExists("output");
		CleanDirectory("output");
		
		EnsureDirectoryExists("output/jar");
		CleanDirectory("output/jar");

		StartProcess("mvn", new ProcessSettings
		{
		  Arguments = new ProcessArgumentBuilder()
		    .Append("package")
		});

		CopyFiles("target/*.jar", "output/jar");
	}); 

Task("Publish")
  .IsDependentOn("Build")
  .Does(() => 
  {
      var jarFileName = System.IO.Path.GetFullPath($"output/jar/stoneassemblies-keycloak-{NuGetVersionV2}-jar-with-dependencies.jar");
      var mavenRepositoryUrl = "https://pkgs.dev.azure.com/alexfdezsauco/_packaging/maven/maven/v1";
      var mavenRepositoryName = "maven";

      // TODO: Add parameters.
    	StartProcess("mvn", new ProcessSettings
      {
        Arguments = new ProcessArgumentBuilder()
          .Append("deploy:deploy-file")
          .Append($"-Durl={mavenRepositoryUrl}")
          .Append($"-DrepositoryId={mavenRepositoryName}")
          .Append($"-Dfile={jarFileName}")
          .Append($"-DgroupId=stoneassemblies")
          .Append($"-DartifactId=stoneassemblies-keycloak")
          .Append($"-Dversion={NuGetVersionV2}")
      });
  });

Task("Pack")
  .IsDependentOn("Build")
  .Does(() => 
  {
  });

RunTarget(target);

        public static ProcessArgumentBuilder AppendQuotedSecretUnlessNullWhitespaceOrEmpty(this ProcessArgumentBuilder builder, string argument, string value)
        {
            if (string.IsNullOrWhiteSpace(value))
            {
                return builder;
            }

            return builder.Append(argument).AppendQuotedSecret(value);
        }

        public static ProcessArgumentBuilder AppendQuotedSecretUnlessNullWhitespaceOrEmpty(this ProcessArgumentBuilder builder, string text)
        {
            if (string.IsNullOrWhiteSpace(text))
            {
                return builder;
            }

            return builder.AppendQuotedSecret(text);
        }

        public static ProcessArgumentBuilder AppendQuotedUnlessNullWhitespaceOrEmpty(this ProcessArgumentBuilder builder, string text)
        {
            if (string.IsNullOrWhiteSpace(text))
            {
                return builder;
            }

            return builder.AppendQuoted(text);
        }

        public static ProcessArgumentBuilder AppendQuotedUnlessNullWhitespaceOrEmpty(this ProcessArgumentBuilder builder, string argument, string value)
        {
            if (string.IsNullOrWhiteSpace(value))
            {
                return builder;
            }

            return builder.Append(argument).AppendQuoted(value);
        }

        public static ProcessArgumentBuilder AppendUnlessNullWhitespaceOrEmpty(this ProcessArgumentBuilder builder, string text)
        {
            if (string.IsNullOrWhiteSpace(text))
            {
                return builder;
            }

            return builder.Append(text);
        }


		public ProcessArgumentBuilder Append(string arg)
		{
			args.Add(arg);
			return this;
		}

		public ProcessArgumentBuilder AppendQuoted(string arg)
		{
			args.Add($"\"{arg}\"");
			return this;
		}
		public static ProcessResult Run(FileInfo exe, ProcessArgumentBuilder builder)
		{
			var p = new ProcessRunner(exe, builder);
			return p.WaitForExit();
		}

//////////////////////////////////////////////////////////////////////
// TOOLS
//////////////////////////////////////////////////////////////////////

using Path = System.IO.Path;
using IO = System.IO;
using System.Text.RegularExpressions;
using Cake.Common.Tools;

//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");

///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////
var localPackagesDir = "../LocalPackages";
var buildDir = @".\build";
var unpackFolder = Path.Combine(buildDir, "temp");
var unpackFolderFullPath = Path.GetFullPath(unpackFolder);
var artifactsDir = @".\artifacts";
var nugetVersion = string.Empty;
var nugetPackageFile = string.Empty;

///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////
Setup(context =>
{
    
});

Teardown(context =>
{
    Information("Finished running tasks.");
});

//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////

Task("Clean")
    .Does(() =>
{
    CleanDirectory(buildDir);
    CleanDirectory(unpackFolder);
    CleanDirectory(artifactsDir);
});

// Task("Restore-NuGet-Packages")
//     .IsDependentOn("Clean")
//     .Does(() =>
// {
//     NuGetRestore("./src/Example.sln");
// });

Task("Install-NuGet-Provider")
    .WithCriteria(BuildSystem.IsRunningOnTeamCity)
    .Does(() =>
{
    var processArgumentBuilder = new ProcessArgumentBuilder();
    processArgumentBuilder.Append("-Command");
    processArgumentBuilder.Append($"\"Install-PackageProvider -Name NuGet -RequiredVersion 2.8.5.201 -Force\"");
    var processSettings = new ProcessSettings { Arguments = processArgumentBuilder, WorkingDirectory = buildDir };
    StartProcess("powershell.exe", processSettings);
    Information($"Saved module to {unpackFolderFullPath}");
});

Task("Unpack-Source-Package")
    .IsDependentOn("Clean")
    .IsDependentOn("Install-NuGet-Provider")
    .Does(() => 
{
    var processArgumentBuilder = new ProcessArgumentBuilder();
    processArgumentBuilder.Append("-Command");
    processArgumentBuilder.Append($"\"Save-Module -Name AWSPowerShell -Path {unpackFolderFullPath}\"");
    var processSettings = new ProcessSettings { Arguments = processArgumentBuilder, WorkingDirectory = buildDir };
    StartProcess("powershell.exe", processSettings);
    Information($"Saved module to {unpackFolderFullPath}");
});

Task("GetVersion")
    .IsDependentOn("Unpack-Source-Package")
    .Does(() => 
{
    Information("Determining version number");
    Information(System.IO.Directory.GetCurrentDirectory());

    nugetVersion = new DirectoryInfo(unpackFolderFullPath)
                .GetDirectories()[0] // AWSPowerShell
                .GetDirectories()[0].Name; // The version

    Information($"Calculated version number: {nugetVersion}");

    if(BuildSystem.IsRunningOnTeamCity)
        BuildSystem.TeamCity.SetBuildNumber(nugetVersion);
});

Task("Pack")
    .IsDependentOn("GetVersion")
    .Does(() =>
{
    Information($"Building Octopus.Dependencies.AWSPS v{nugetVersion}");
    
    NuGetPack("awsps.nuspec", new NuGetPackSettings {
        BasePath = Path.Combine(unpackFolder, "AWSPowerShell", nugetVersion),
        OutputDirectory = artifactsDir,
        ArgumentCustomization = args => args.Append($"-Properties \"version={nugetVersion};subpackagename=AWSPS\"")
    });

    if (nugetVersion.EndsWith(".0")) {
        // nuget drops trailing zeros
        nugetVersion = string.Join(".", nugetVersion.Split('.').Take(3));
    }
});

Task("Publish")
    .WithCriteria(BuildSystem.IsRunningOnTeamCity)
    .IsDependentOn("Pack")
    .Does(() => 
{
    NuGetPush($"{artifactsDir}/Octopus.Dependencies.AWSPS.{nugetVersion}.nupkg", new NuGetPushSettings {
        Source = "https://f.feedz.io/octopus-deploy/dependencies/nuget",
        ApiKey = EnvironmentVariable("FeedzIoApiKey")
    });
});

Task("CopyToLocalPackages")
    .WithCriteria(BuildSystem.IsLocalBuild)
    .IsDependentOn("Pack")
    .Does(() => 
{
    CreateDirectory(localPackagesDir);
    CopyFileToDirectory(Path.Combine(artifactsDir, $"Octopus.Dependencies.AWSPS.{nugetVersion}.nupkg"), localPackagesDir);
});


//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////

Task("FullChain")
    .IsDependentOn("Clean")
    .IsDependentOn("Unpack-Source-Package")
    .IsDependentOn("GetVersion")
    .IsDependentOn("Pack")
    .IsDependentOn("Publish")
    .IsDependentOn("CopyToLocalPackages");

Task("Default").Does(() => 
{  
    RunTarget("FullChain");
});

//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////

RunTarget(target);

Cake.Core.IO.ProcessArgumentBuilder : IReadOnlyCollection

Constructors :

public ProcessArgumentBuilder()

Methods :

public Int32 get_Count()
public Void Clear()
public Void Append(IProcessArgument argument = )
public Void Prepend(IProcessArgument argument = )
public String Render()
public String RenderSafe()
public String FilterUnsafe(String source = )
public static ProcessArgumentBuilder op_Implicit(String value = )
public static ProcessArgumentBuilder FromString(String value = )
public static ProcessArgumentBuilder FromStringQuoted(String value = )
public static ProcessArgumentBuilder FromStrings(IEnumerable<String> values = )
public static ProcessArgumentBuilder FromStringsQuoted(IEnumerable<String> values = )
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()