Skip to content

Commit

Permalink
Resolved code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
icnocop committed Mar 27, 2023
1 parent 2bd7960 commit 991a334
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,32 @@ public class DotNetBuildTaskBuilder

public DotNetBuildTaskBuilder()
{
dotnetBuildTask = new DotNetBuildTask
{
Run = "dotnet build"
};
this.dotnetBuildTask = new DotNetBuildTask();
this.dotnetBuildTask.Run = "dotnet build";
}

public DotNetBuildTaskBuilder WithName(string name)
{
dotnetBuildTask.Name = name;
this.dotnetBuildTask.Name = name;

return this;
}

public DotNetBuildTaskBuilder WithRestore(bool restore = true)
{
dotnetBuildTask.Restore = restore;
this.dotnetBuildTask.Restore = restore;

return this;
}

public DotNetBuildTask Build()
{
if (!dotnetBuildTask.Restore)
dotnetBuildTask.Run += " --no-restore";
if (this.dotnetBuildTask.Restore is false)
{
this.dotnetBuildTask.Run += " --no-restore";
}

return dotnetBuildTask;
return this.dotnetBuildTask;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,55 @@ public class NuGetPushTaskBuilder

public NuGetPushTaskBuilder()
{
nugetPushTask = new NuGetPushTask();
this.nugetPushTask = new NuGetPushTask();
}

public NuGetPushTaskBuilder WithName(string name)
{
nugetPushTask.Name = name;
this.nugetPushTask.Name = name;

return this;
}

public NuGetPushTaskBuilder WithSearchPath(string searchPath)
{
nugetPushTask.SearchPath = searchPath;
this.nugetPushTask.SearchPath = searchPath;

return this;
}

public NuGetPushTaskBuilder WithApiKey(string apiKey)
{
nugetPushTask.ApiKey = apiKey;
this.nugetPushTask.ApiKey = apiKey;

return this;
}

public NuGetPushTaskBuilder WithDestination(string destination)
{
nugetPushTask.Destination = destination;
this.nugetPushTask.Destination = destination;

return this;
}

public NuGetPushTask Build()
{
if (!string.IsNullOrEmpty(nugetPushTask.SearchPath))
nugetPushTask.Run += $" \"{nugetPushTask.SearchPath}\"";
if (!string.IsNullOrEmpty(this.nugetPushTask.SearchPath))
{
this.nugetPushTask.Run += $" \"{this.nugetPushTask.SearchPath}\"";
}

if (!string.IsNullOrEmpty(nugetPushTask.ApiKey))
nugetPushTask.Run += $" --api-key {nugetPushTask.ApiKey}";
if (!string.IsNullOrEmpty(this.nugetPushTask.ApiKey))
{
this.nugetPushTask.Run += $" --api-key {this.nugetPushTask.ApiKey}";
}

if (!string.IsNullOrEmpty(nugetPushTask.Destination))
nugetPushTask.Run += $" --source \"{nugetPushTask.Destination}\"";
if (!string.IsNullOrEmpty(this.nugetPushTask.Destination))
{
this.nugetPushTask.Run += $" --source \"{this.nugetPushTask.Destination}\"";
}

return nugetPushTask;
return this.nugetPushTask;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ public class NuGetPushTask : GithubTask
public string Run = "dotnet nuget push";

internal string SearchPath { get; set; }

internal string ApiKey { get; set; }

internal string Destination { get; set; }
}
}

0 comments on commit 991a334

Please sign in to comment.