Browse Source

Merge pull request #7378 from abpframework/volo/issue/4990

Open the microservice document after creating the microservice-pro template
pull/7389/head
Alper Ebicoglu 6 years ago
committed by GitHub
parent
commit
f3107749b7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs
  2. 5
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs
  3. 17
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs

26
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs

@ -17,6 +17,7 @@ using Volo.Abp.Cli.ProjectBuilding;
using Volo.Abp.Cli.ProjectBuilding.Building; using Volo.Abp.Cli.ProjectBuilding.Building;
using Volo.Abp.Cli.ProjectBuilding.Templates.App; using Volo.Abp.Cli.ProjectBuilding.Templates.App;
using Volo.Abp.Cli.ProjectBuilding.Templates.Console; using Volo.Abp.Cli.ProjectBuilding.Templates.Console;
using Volo.Abp.Cli.ProjectBuilding.Templates.Microservice;
using Volo.Abp.Cli.ProjectModification; using Volo.Abp.Cli.ProjectModification;
using Volo.Abp.Cli.Utils; using Volo.Abp.Cli.Utils;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
@ -234,6 +235,10 @@ namespace Volo.Abp.Cli.Commands
var isCommercial = template == AppProTemplate.TemplateName; var isCommercial = template == AppProTemplate.TemplateName;
OpenThanksPage(uiFramework, databaseProvider, isTiered || commandLineArgs.Options.ContainsKey("separate-identity-server"), isCommercial); OpenThanksPage(uiFramework, databaseProvider, isTiered || commandLineArgs.Options.ContainsKey("separate-identity-server"), isCommercial);
} }
else if (MicroserviceTemplateBase.IsMicroserviceTemplate(template))
{
OpenMicroserviceDocumentPage();
}
} }
private string GetNewConnectionStringByDbms(DatabaseManagementSystem databaseManagementSystem, string outputFolder) private string GetNewConnectionStringByDbms(DatabaseManagementSystem databaseManagementSystem, string outputFolder)
@ -263,19 +268,14 @@ namespace Volo.Abp.Cli.Commands
var tieredYesNo = tiered ? "yes" : "no"; var tieredYesNo = tiered ? "yes" : "no";
var url = $"https://{urlPrefix}.abp.io/project-created-success?ui={uiFramework:g}&db={databaseProvider:g}&tiered={tieredYesNo}"; var url = $"https://{urlPrefix}.abp.io/project-created-success?ui={uiFramework:g}&db={databaseProvider:g}&tiered={tieredYesNo}";
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) CmdHelper.OpenWebPage(url);
{ }
url = url.Replace("&", "^&");
Process.Start(new ProcessStartInfo("cmd", $"/c start {url}") { CreateNoWindow = true }); private void OpenMicroserviceDocumentPage()
} {
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) var url = "https://docs.abp.io/en/commercial/latest/startup-templates/microservice/index";
{
Process.Start("xdg-open", url); CmdHelper.OpenWebPage(url);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Process.Start("open", url);
}
} }
private bool GetCreateSolutionFolderPreference(CommandLineArgs commandLineArgs) private bool GetCreateSolutionFolderPreference(CommandLineArgs commandLineArgs)

5
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Microservice/MicroserviceTemplateBase.cs

@ -12,6 +12,11 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.Microservice
{ {
} }
public static bool IsMicroserviceTemplate(string templateName)
{
return templateName == MicroserviceProTemplate.TemplateName;
}
public override IEnumerable<ProjectBuildPipelineStep> GetCustomSteps(ProjectBuildContext context) public override IEnumerable<ProjectBuildPipelineStep> GetCustomSteps(ProjectBuildContext context)
{ {
var steps = new List<ProjectBuildPipelineStep>(); var steps = new List<ProjectBuildPipelineStep>();

17
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs

@ -7,6 +7,23 @@ namespace Volo.Abp.Cli.Utils
{ {
public static int SuccessfulExitCode = 0; public static int SuccessfulExitCode = 0;
public static void OpenWebPage(string url)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
url = url.Replace("&", "^&");
Process.Start(new ProcessStartInfo("cmd", $"/c start {url}") { CreateNoWindow = true });
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
Process.Start("xdg-open", url);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Process.Start("open", url);
}
}
public static void Run(string file, string arguments) public static void Run(string file, string arguments)
{ {
var procStartInfo = new ProcessStartInfo(file, arguments); var procStartInfo = new ProcessStartInfo(file, arguments);

Loading…
Cancel
Save