Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN dotnet build src/NetCoreToolService --configuration Release --no-restore
RUN dotnet publish src/NetCoreToolService --output /srv --no-build

FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine
ARG templates_version=1.4.1
ARG templates_version=1.*-*
ARG TEMPLATE_CHECKOUT_TARGET
WORKDIR /srv
COPY --from=build /srv .
Expand Down
2 changes: 1 addition & 1 deletion install-template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dotnet nuget add source https://pkgs.dev.azure.com/dotnet/Steeltoe/_packaging/ci

if [[ -z "$TEMPLATE_CHECKOUT_TARGET" ]] ;then
dotnet new install Steeltoe.NetCoreTool.Templates::${templates_version} &&\
dotnet new --list | grep steeltoe-webapi
dotnet new list | grep steeltoe-webapi
else
cd /usr/local/src
git clone https://github.com/SteeltoeOSS/NetCoreToolTemplates
Expand Down
8 changes: 4 additions & 4 deletions src/NetCoreToolService/Controllers/NewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public async Task<ActionResult> GetTemplates()
[HttpPut("nuget/{nuGetId}")]
public async Task<ActionResult> InstallTemplates(string nuGetId)
{
await _commandExecutor.ExecuteAsync($"{NetCoreTool.Command} new --uninstall {nuGetId}");
await _commandExecutor.ExecuteAsync($"{NetCoreTool.Command} new uninstall {nuGetId}");
var oldTemplates = await GetTemplateDictionary();
var installCommand = await _commandExecutor.ExecuteAsync($"{NetCoreTool.Command} new --install {nuGetId}");
var installCommand = await _commandExecutor.ExecuteAsync($"{NetCoreTool.Command} new install {nuGetId}");
const string notFoundError = "error NU1101: ";
if (installCommand.Output.Contains(notFoundError))
{
Expand Down Expand Up @@ -98,7 +98,7 @@ public async Task<ActionResult> UninstallTemplates(string nuGetId)
{
var oldTemplates = await GetTemplateDictionary();
var uninstallCommand =
await _commandExecutor.ExecuteAsync($"{NetCoreTool.Command} new --uninstall {nuGetId}");
await _commandExecutor.ExecuteAsync($"{NetCoreTool.Command} new uninstall {nuGetId}");
if (uninstallCommand.Output.Contains($"Could not find something to uninstall"))
{
return NotFound($"No templates with NuGet ID '{nuGetId}' installed.");
Expand Down Expand Up @@ -255,7 +255,7 @@ public async Task<ActionResult> GetTemplateProject(

private async Task<TemplateDictionary> GetTemplateDictionary()
{
var listCommand = await _commandExecutor.ExecuteAsync($"{NetCoreTool.Command} new --list");
var listCommand = await _commandExecutor.ExecuteAsync($"{NetCoreTool.Command} new list");

var lines = listCommand.Output.Split('\n').ToList()
.FindAll(line => !string.IsNullOrWhiteSpace(line));
Expand Down
18 changes: 9 additions & 9 deletions test/NetCoreToolService.Test/Controllers/NewControllerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async Task GetTemplates_Should_Return_AllTemplates()
{
// Arrange
var executor = new Mock<ICommandExecutor>();
executor.Setup(expression: c => c.ExecuteAsync($"{NetCoreTool.Command} new --list", null, -1))
executor.Setup(expression: c => c.ExecuteAsync($"{NetCoreTool.Command} new list", null, -1))
.ReturnsAsync(new CommandResult
{
ExitCode = 0,
Expand Down Expand Up @@ -59,7 +59,7 @@ public async Task InstallTemplates_Should_Return_InstalledTemplates()
{
// Arrange
var executor = new Mock<ICommandExecutor>();
executor.SetupSequence(c => c.ExecuteAsync($"{NetCoreTool.Command} new --list", null, -1))
executor.SetupSequence(c => c.ExecuteAsync($"{NetCoreTool.Command} new list", null, -1))
.ReturnsAsync(new CommandResult
{
ExitCode = 0,
Expand All @@ -82,7 +82,7 @@ Other New Template ont bigtalk otherstuff
",
}
);
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new --install My.Templates", null, -1))
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new install My.Templates", null, -1))
.ReturnsAsync(new CommandResult
{
ExitCode = 0,
Expand Down Expand Up @@ -111,7 +111,7 @@ public async Task UninstallTemplates_Should_Return_UninstalledTemplates()
{
// Arrange
var executor = new Mock<ICommandExecutor>();
executor.SetupSequence(c => c.ExecuteAsync($"{NetCoreTool.Command} new --list", null, -1))
executor.SetupSequence(c => c.ExecuteAsync($"{NetCoreTool.Command} new list", null, -1))
.ReturnsAsync(new CommandResult
{
ExitCode = 0,
Expand All @@ -134,7 +134,7 @@ My Other Template myot otherlang othertags
",
}
);
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new --uninstall My.Templates", null, -1))
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new uninstall My.Templates", null, -1))
.ReturnsAsync(new CommandResult
{
ExitCode = 0,
Expand Down Expand Up @@ -296,7 +296,7 @@ public async Task InstallTemplates_UnknownNuGet_Should_Return_BadRequest()
{
// Arrange
var executor = new Mock<ICommandExecutor>();
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new --list", null, -1))
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new list", null, -1))
.ReturnsAsync(new CommandResult
{
ExitCode = 0,
Expand All @@ -308,7 +308,7 @@ My Other Template myot otherlang othertags
}
);
executor.Setup(c =>
c.ExecuteAsync($"{NetCoreTool.Command} new --install No.Such.Template", null, -1))
c.ExecuteAsync($"{NetCoreTool.Command} new install No.Such.Template", null, -1))
.ReturnsAsync(new CommandResult
{
ExitCode = 2,
Expand All @@ -335,7 +335,7 @@ public async Task UninstallTemplates_UnknownNuGet_Should_Return_NotFound()
{
// Arrange
var executor = new Mock<ICommandExecutor>();
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new --list", null, -1))
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new list", null, -1))
.ReturnsAsync(new CommandResult
{
ExitCode = 0,
Expand All @@ -344,7 +344,7 @@ public async Task UninstallTemplates_UnknownNuGet_Should_Return_NotFound()
",
}
);
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new --uninstall My.Templates", null, -1))
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new uninstall My.Templates", null, -1))
.ReturnsAsync(new CommandResult
{
ExitCode = 0,
Expand Down