Browse Source

added InstallationCompleteMessage which comes from abp.io ... closes #10079

pull/10084/head
Alper Ebicoglu 5 years ago
parent
commit
2cd9c25132
  1. 42
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs
  2. 17
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AddModuleInfoOutput.cs
  3. 6
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ModuleInfo.cs
  4. 10
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs

42
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs

@ -14,11 +14,25 @@ namespace Volo.Abp.Cli.Commands
{
public class AddModuleCommand : IConsoleCommand, ITransientDependency
{
private AddModuleInfoOutput _lastAddedModuleInfo;
public ILogger<AddModuleCommand> Logger { get; set; }
protected SolutionModuleAdder SolutionModuleAdder { get; }
public SolutionAbpVersionFinder SolutionAbpVersionFinder { get; }
public AddModuleInfoOutput LastAddedModuleInfo
{
get
{
if (_lastAddedModuleInfo == null)
{
throw new Exception("You need to add a module first to get the last added module info!");
}
return _lastAddedModuleInfo;
}
}
public AddModuleCommand(SolutionModuleAdder solutionModuleAdder, SolutionAbpVersionFinder solutionAbpVersionFinder)
{
SolutionModuleAdder = solutionModuleAdder;
@ -51,16 +65,24 @@ namespace Volo.Abp.Cli.Commands
version = SolutionAbpVersionFinder.Find(solutionFile);
}
await SolutionModuleAdder.AddAsync(
solutionFile,
commandLineArgs.Target,
version,
skipDbMigrations,
withSourceCode,
addSourceCodeToSolutionFile,
newTemplate,
newProTemplate
);
var moduleInfo = await SolutionModuleAdder.AddAsync(
solutionFile,
commandLineArgs.Target,
version,
skipDbMigrations,
withSourceCode,
addSourceCodeToSolutionFile,
newTemplate,
newProTemplate
);
_lastAddedModuleInfo = new AddModuleInfoOutput
{
DisplayName = moduleInfo.DisplayName,
Name = moduleInfo.Name,
DocumentationLinks = moduleInfo.DocumentationLinks,
InstallationCompleteMessage = moduleInfo.InstallationCompleteMessage
};
}
public string GetUsageInfo()

17
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/AddModuleInfoOutput.cs

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Volo.Abp.Cli.ProjectModification
{
public class AddModuleInfoOutput
{
public string Name { get; set; }
public string DisplayName { get; set; }
public string DocumentationLinks { get; set; }
public string InstallationCompleteMessage { get; set; }
}
}

6
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ModuleInfo.cs

@ -18,6 +18,8 @@ namespace Volo.Abp.Cli.ProjectModification
public List<NpmPackageInfo> NpmPackages { get; set; }
public string InstallationCompleteMessage { get; set; }
public string GetFirstDocumentationLinkOrNull()
{
if (string.IsNullOrWhiteSpace(DocumentationLinks))
@ -26,8 +28,8 @@ namespace Volo.Abp.Cli.ProjectModification
}
var docs = DocumentationLinks.Split(" ", StringSplitOptions.RemoveEmptyEntries);
return docs.Any() ?
docs.First() :
return docs.Any() ?
docs.First() :
null;
}
}

10
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs

@ -78,8 +78,7 @@ namespace Volo.Abp.Cli.ProjectModification
Logger = NullLogger<SolutionModuleAdder>.Instance;
}
public virtual async Task AddAsync(
[NotNull] string solutionFile,
public virtual async Task<ModuleWithMastersInfo> AddAsync([NotNull] string solutionFile,
[NotNull] string moduleName,
string version,
bool skipDbMigrations = false,
@ -94,8 +93,7 @@ namespace Volo.Abp.Cli.ProjectModification
var module = await GetModuleInfoAsync(moduleName, newTemplate, newProTemplate);
module = RemoveIncompatiblePackages(module, version);
Logger.LogInformation(
$"Installing module '{module.Name}' to the solution '{Path.GetFileNameWithoutExtension(solutionFile)}'");
Logger.LogInformation($"Installing module '{module.Name}' to the solution '{Path.GetFileNameWithoutExtension(solutionFile)}'");
var projectFiles = ProjectFinder.GetProjectFiles(solutionFile);
@ -137,6 +135,8 @@ namespace Volo.Abp.Cli.ProjectModification
{
CmdHelper.OpenWebPage(documentationLink);
}
return module;
}
private ModuleWithMastersInfo RemoveIncompatiblePackages(ModuleWithMastersInfo module, string version)
@ -146,7 +146,7 @@ namespace Volo.Abp.Cli.ProjectModification
return module;
}
private bool IsPackageInCompatible(string minVersion, string maxVersion, string version)
private static bool IsPackageInCompatible(string minVersion, string maxVersion, string version)
{
try
{

Loading…
Cancel
Save