2016-09-23 16:11:44 +00:00
|
|
|
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
|
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
|
|
|
|
|
|
using Microsoft.DotNet.Cli.Utils;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Tools.Test.Utilities
|
|
|
|
|
{
|
|
|
|
|
public sealed class Publish3Command : TestCommand
|
|
|
|
|
{
|
2016-09-30 22:47:23 +00:00
|
|
|
|
private string _framework;
|
|
|
|
|
private string _runtime;
|
|
|
|
|
|
2016-09-23 16:11:44 +00:00
|
|
|
|
public Publish3Command()
|
|
|
|
|
: base("dotnet")
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-30 22:47:23 +00:00
|
|
|
|
public Publish3Command WithFramework(string framework)
|
|
|
|
|
{
|
|
|
|
|
_framework = framework;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Publish3Command WithRuntime(string runtime)
|
|
|
|
|
{
|
|
|
|
|
_runtime = runtime;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-23 16:11:44 +00:00
|
|
|
|
public override CommandResult Execute(string args = "")
|
|
|
|
|
{
|
2016-09-30 22:47:23 +00:00
|
|
|
|
args = $"publish3 {args} {BuildArgs()}";
|
2016-09-23 16:11:44 +00:00
|
|
|
|
return base.Execute(args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override CommandResult ExecuteWithCapturedOutput(string args = "")
|
|
|
|
|
{
|
2016-09-30 22:47:23 +00:00
|
|
|
|
args = $"publish3 {args} {BuildArgs()}";
|
2016-09-23 16:11:44 +00:00
|
|
|
|
return base.ExecuteWithCapturedOutput(args);
|
|
|
|
|
}
|
2016-09-30 22:47:23 +00:00
|
|
|
|
|
|
|
|
|
private string BuildArgs()
|
|
|
|
|
{
|
|
|
|
|
return string.Join(" ",
|
|
|
|
|
FrameworkOption,
|
|
|
|
|
RuntimeOption);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string FrameworkOption => string.IsNullOrEmpty(_framework) ? "" : $"-f {_framework}";
|
|
|
|
|
private string RuntimeOption => string.IsNullOrEmpty(_runtime) ? "" : $"-r {_runtime}";
|
2016-09-23 16:11:44 +00:00
|
|
|
|
}
|
|
|
|
|
}
|