Skip to content

Commit d3cfffd

Browse files
authored
Update version spec, replace deprecated command-line arguments (#13)
1 parent bd0aa6d commit d3cfffd

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ RUN dotnet build src/NetCoreToolService --configuration Release --no-restore
77
RUN dotnet publish src/NetCoreToolService --output /srv --no-build
88

99
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine
10-
ARG templates_version=1.4.1
10+
ARG templates_version=1.*-*
1111
ARG TEMPLATE_CHECKOUT_TARGET
1212
WORKDIR /srv
1313
COPY --from=build /srv .

install-template.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ dotnet nuget add source https://pkgs.dev.azure.com/dotnet/Steeltoe/_packaging/ci
44

55
if [[ -z "$TEMPLATE_CHECKOUT_TARGET" ]] ;then
66
dotnet new install Steeltoe.NetCoreTool.Templates::${templates_version} &&\
7-
dotnet new --list | grep steeltoe-webapi
7+
dotnet new list | grep steeltoe-webapi
88
else
99
cd /usr/local/src
1010
git clone https://github.com/SteeltoeOSS/NetCoreToolTemplates

src/NetCoreToolService/Controllers/NewController.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ public async Task<ActionResult> GetTemplates()
6767
[HttpPut("nuget/{nuGetId}")]
6868
public async Task<ActionResult> InstallTemplates(string nuGetId)
6969
{
70-
await _commandExecutor.ExecuteAsync($"{NetCoreTool.Command} new --uninstall {nuGetId}");
70+
await _commandExecutor.ExecuteAsync($"{NetCoreTool.Command} new uninstall {nuGetId}");
7171
var oldTemplates = await GetTemplateDictionary();
72-
var installCommand = await _commandExecutor.ExecuteAsync($"{NetCoreTool.Command} new --install {nuGetId}");
72+
var installCommand = await _commandExecutor.ExecuteAsync($"{NetCoreTool.Command} new install {nuGetId}");
7373
const string notFoundError = "error NU1101: ";
7474
if (installCommand.Output.Contains(notFoundError))
7575
{
@@ -98,7 +98,7 @@ public async Task<ActionResult> UninstallTemplates(string nuGetId)
9898
{
9999
var oldTemplates = await GetTemplateDictionary();
100100
var uninstallCommand =
101-
await _commandExecutor.ExecuteAsync($"{NetCoreTool.Command} new --uninstall {nuGetId}");
101+
await _commandExecutor.ExecuteAsync($"{NetCoreTool.Command} new uninstall {nuGetId}");
102102
if (uninstallCommand.Output.Contains($"Could not find something to uninstall"))
103103
{
104104
return NotFound($"No templates with NuGet ID '{nuGetId}' installed.");
@@ -255,7 +255,7 @@ public async Task<ActionResult> GetTemplateProject(
255255

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

260260
var lines = listCommand.Output.Split('\n').ToList()
261261
.FindAll(line => !string.IsNullOrWhiteSpace(line));

test/NetCoreToolService.Test/Controllers/NewControllerTest.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public async Task GetTemplates_Should_Return_AllTemplates()
2424
{
2525
// Arrange
2626
var executor = new Mock<ICommandExecutor>();
27-
executor.Setup(expression: c => c.ExecuteAsync($"{NetCoreTool.Command} new --list", null, -1))
27+
executor.Setup(expression: c => c.ExecuteAsync($"{NetCoreTool.Command} new list", null, -1))
2828
.ReturnsAsync(new CommandResult
2929
{
3030
ExitCode = 0,
@@ -59,7 +59,7 @@ public async Task InstallTemplates_Should_Return_InstalledTemplates()
5959
{
6060
// Arrange
6161
var executor = new Mock<ICommandExecutor>();
62-
executor.SetupSequence(c => c.ExecuteAsync($"{NetCoreTool.Command} new --list", null, -1))
62+
executor.SetupSequence(c => c.ExecuteAsync($"{NetCoreTool.Command} new list", null, -1))
6363
.ReturnsAsync(new CommandResult
6464
{
6565
ExitCode = 0,
@@ -82,7 +82,7 @@ Other New Template ont bigtalk otherstuff
8282
",
8383
}
8484
);
85-
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new --install My.Templates", null, -1))
85+
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new install My.Templates", null, -1))
8686
.ReturnsAsync(new CommandResult
8787
{
8888
ExitCode = 0,
@@ -111,7 +111,7 @@ public async Task UninstallTemplates_Should_Return_UninstalledTemplates()
111111
{
112112
// Arrange
113113
var executor = new Mock<ICommandExecutor>();
114-
executor.SetupSequence(c => c.ExecuteAsync($"{NetCoreTool.Command} new --list", null, -1))
114+
executor.SetupSequence(c => c.ExecuteAsync($"{NetCoreTool.Command} new list", null, -1))
115115
.ReturnsAsync(new CommandResult
116116
{
117117
ExitCode = 0,
@@ -134,7 +134,7 @@ My Other Template myot otherlang othertags
134134
",
135135
}
136136
);
137-
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new --uninstall My.Templates", null, -1))
137+
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new uninstall My.Templates", null, -1))
138138
.ReturnsAsync(new CommandResult
139139
{
140140
ExitCode = 0,
@@ -296,7 +296,7 @@ public async Task InstallTemplates_UnknownNuGet_Should_Return_BadRequest()
296296
{
297297
// Arrange
298298
var executor = new Mock<ICommandExecutor>();
299-
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new --list", null, -1))
299+
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new list", null, -1))
300300
.ReturnsAsync(new CommandResult
301301
{
302302
ExitCode = 0,
@@ -308,7 +308,7 @@ My Other Template myot otherlang othertags
308308
}
309309
);
310310
executor.Setup(c =>
311-
c.ExecuteAsync($"{NetCoreTool.Command} new --install No.Such.Template", null, -1))
311+
c.ExecuteAsync($"{NetCoreTool.Command} new install No.Such.Template", null, -1))
312312
.ReturnsAsync(new CommandResult
313313
{
314314
ExitCode = 2,
@@ -335,7 +335,7 @@ public async Task UninstallTemplates_UnknownNuGet_Should_Return_NotFound()
335335
{
336336
// Arrange
337337
var executor = new Mock<ICommandExecutor>();
338-
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new --list", null, -1))
338+
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new list", null, -1))
339339
.ReturnsAsync(new CommandResult
340340
{
341341
ExitCode = 0,
@@ -344,7 +344,7 @@ public async Task UninstallTemplates_UnknownNuGet_Should_Return_NotFound()
344344
",
345345
}
346346
);
347-
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new --uninstall My.Templates", null, -1))
347+
executor.Setup(c => c.ExecuteAsync($"{NetCoreTool.Command} new uninstall My.Templates", null, -1))
348348
.ReturnsAsync(new CommandResult
349349
{
350350
ExitCode = 0,

0 commit comments

Comments
 (0)