Skip to content

Commit

Permalink
minor string changes, sdk version check (#3004)
Browse files Browse the repository at this point in the history
* minor string changes, sdk version check

* bump up dotnet-scaffold version
  • Loading branch information
deepchoudhery authored Oct 9, 2024
1 parent 8118055 commit ba8c453
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 24 deletions.
2 changes: 1 addition & 1 deletion eng/Versions.DotNetScaffold.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<VersionPrefix>9.0.0</VersionPrefix>
<PreReleaseVersionLabel>preview</PreReleaseVersionLabel>
<PreReleaseVersionIteration>8</PreReleaseVersionIteration>
<PreReleaseVersionIteration>9</PreReleaseVersionIteration>
<IncludeSourceRevisionInInformationalVersion>False</IncludeSourceRevisionInInformationalVersion>
<IsServicingBuild Condition="'$(PreReleaseVersionLabel)' == 'servicing'">true</IsServicingBuild>
<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ For example :
var builder = Host.CreateScaffoldBuilder();
var newScaffolder = builder.AddScaffolder("scaffolder");
newScaffolder.WithCategory("Custom")
.WithDescription("Project for scaffolding!")
.WithDescription("Project for scaffolding.")
.WithOption(projectOption)
.WithStep<CodeModificationStep>(config =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static bool AddPackage(string packageName, ILogger logger, string? projec
logger.LogInformation($"\n{stdErr}");
}

logger.LogInformation("Failed!");
logger.LogInformation("Failed.");
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ For example:
var builder = Host.CreateScaffoldBuilder();
var newScaffolder = builder.AddScaffolder("scaffolder");
newScaffolder.WithCategory("Custom")
.WithDescription("Project for scaffolding!")
.WithDescription("Project for scaffolding.")
.WithOption(projectOption)
.WithStep<ScaffoldStep>(config =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private void ThrowIfCaptureSet()
{
if (_capture != null)
{
throw new InvalidOperationException("Already capturing stream!"); // TODO: Localize this?
throw new InvalidOperationException("Already capturing stream."); // TODO: Localize this?
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ private void RegisterMsbuild()

//register newest MSBuild from the newest dotnet sdk installed.
var sdkPath = Directory.GetDirectories(sdkBasePath)
.OrderByDescending(d => new DirectoryInfo(d).Name)
.FirstOrDefault();
.Select(d => new DirectoryInfo(d).Name)
.Where(name => Version.TryParse(name.Split('-')[0], out _))
.OrderByDescending(name => name)
.FirstOrDefault();

if (string.IsNullOrEmpty(sdkPath))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ For example :
var builder = Host.CreateScaffoldBuilder();
var newScaffolder = builder.AddScaffolder("scaffolder");
newScaffolder.WithCategory("Custom")
.WithDescription("Project for scaffolding!")
.WithDescription("Project for scaffolding.")
.WithOption(projectOption)
.WithStep<TextTemplatingStep>(config =>
{
Expand Down
6 changes: 3 additions & 3 deletions src/dotnet-scaffolding/dotnet-scaffold-aspire/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

var caching = builder.AddScaffolder("caching");
caching.WithCategory("Aspire")
.WithDescription("Modified Aspire project to make it caching ready!")
.WithDescription("Modified Aspire project to make it caching ready.")
.WithOption(cachingTypeOption)
.WithOption(appHostProjectOption)
.WithOption(projectOption)
Expand All @@ -33,7 +33,7 @@

var database = builder.AddScaffolder("database");
database.WithCategory("Aspire")
.WithDescription("Modifies Aspire project to make it database ready!")
.WithDescription("Modifies Aspire project to make it database ready.")
.WithOption(databaseTypeOption)
.WithOption(appHostProjectOption)
.WithOption(projectOption)
Expand All @@ -49,7 +49,7 @@

var storage = builder.AddScaffolder("storage");
storage.WithCategory("Aspire")
.WithDescription("Modifies Aspire project to make it storage ready!")
.WithDescription("Modifies Aspire project to make it storage ready.")
.WithOption(storageTypeOption)
.WithOption(appHostProjectOption)
.WithOption(projectOption)
Expand Down
10 changes: 5 additions & 5 deletions src/dotnet-scaffolding/dotnet-scaffold-aspnet/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static void Main(string[] args)
out var openApiOption, out var pageTypeOption, out var controllerNameOption, out var viewsOption, out var overwriteOption);

builder.AddScaffolder("blazor-empty")
.WithDisplayName("Razor Component - Empty")
.WithDisplayName("Razor Component")
.WithCategory("Blazor")
.WithDescription("Add an empty razor component to a given project")
.WithOption(projectOption)
Expand Down Expand Up @@ -70,8 +70,8 @@ public static void Main(string[] args)
step.CommandName = "page";
});

builder.AddScaffolder("apicontroller-empty")
.WithDisplayName("API Controller - Empty")
builder.AddScaffolder("apicontroller")
.WithDisplayName("API Controller")
.WithCategory("API")
.WithDescription("Add an empty API Controller to a given project")
.WithOptions([projectOption, fileNameOption, actionsOption])
Expand All @@ -85,8 +85,8 @@ public static void Main(string[] args)
step.CommandName = "apicontroller";
});

builder.AddScaffolder("mvccontroller-empty")
.WithDisplayName("MVC Controller - Empty")
builder.AddScaffolder("mvccontroller")
.WithDisplayName("MVC Controller")
.WithCategory("MVC")
.WithDescription("Add an empty MVC Controller to a given project")
.WithOptions([projectOption, fileNameOption, actionsOption])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public ValueTask<FlowStepResult> RunAsync(IFlowContext context, CancellationToke

if (string.IsNullOrEmpty(displayCategory))
{
return new ValueTask<FlowStepResult>(FlowStepResult.Failure("Unable to find any component categories!"));
return new ValueTask<FlowStepResult>(FlowStepResult.Failure("Unable to find any component categories."));
}
else
{
Expand Down Expand Up @@ -81,7 +81,7 @@ public ValueTask<FlowStepResult> ValidateUserInputAsync(IFlowContext context, Ca
}
else
{
return new ValueTask<FlowStepResult>(FlowStepResult.Failure("No component (dotnet tool) provided!"));
return new ValueTask<FlowStepResult>(FlowStepResult.Failure("No component (dotnet tool) provided."));
}

if (commandInfo is null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public ValueTask<FlowStepResult> RunAsync(IFlowContext context, CancellationToke

if (commandInfoKvp is null || !commandInfoKvp.HasValue || commandInfoKvp.Value.Value is null || string.IsNullOrEmpty(commandInfoKvp.Value.Key))
{
return new ValueTask<FlowStepResult>(FlowStepResult.Failure("Unable to find any commands!"));
return new ValueTask<FlowStepResult>(FlowStepResult.Failure("Unable to find any commands."));
}
else
{
Expand Down Expand Up @@ -104,7 +104,7 @@ public ValueTask<FlowStepResult> ValidateUserInputAsync(IFlowContext context, Ca
}
else
{
return new ValueTask<FlowStepResult>(FlowStepResult.Failure("No component (dotnet tool) provided!"));
return new ValueTask<FlowStepResult>(FlowStepResult.Failure("No component (dotnet tool) provided."));
}

if (commandInfo is null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private ValidationResult Validate(IFlowContext context, string promptVal)

if (!string.IsNullOrEmpty(promptVal) && !ParameterHelpers.CheckType(_parameter.Type, promptVal))
{
return ValidationResult.Error("Invalid input, please try again!");
return ValidationResult.Error("Invalid input, please try again.");
}

return ValidationResult.Success();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public ValueTask<FlowStepResult> ValidateUserInputAsync(IFlowContext context, Ca
new FirstPartyComponentInitializer(_logger, _dotnetToolService).Initialize();
statusContext.Status = "Done\n";
//parse args passed
statusContext.Status = "Parsing args!";
statusContext.Status = "Parsing args.";
var remainingArgs = context.GetRemainingArgs();
if (remainingArgs != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public void Initialize()

foreach (var tool in toolsToInstall)
{
_logger.LogInformation("Installing {tool}!", tool);
_logger.LogInformation("Installing {tool}.", tool);
var successfullyInstalled = _dotnetToolService.InstallDotNetTool(tool, prerelease: true);
if (!successfullyInstalled)
{
_logger.LogInformation("Failed to install {tool}!", tool);
_logger.LogInformation("Failed to install {tool}.", tool);
}
}
}
Expand Down

0 comments on commit ba8c453

Please sign in to comment.