From a1d81ad94905fe611f2f7ff888ac2c2092fa6b85 Mon Sep 17 00:00:00 2001 From: Halil ibrahim Kalkan Date: Wed, 31 Oct 2018 12:17:30 +0300 Subject: [PATCH] Configure download for the service template. --- .../Volo.AbpWebSite.Web/Pages/Templates.cshtml | 1 + .../Pages/Templates.cshtml.cs | 3 +++ .../Templates/MvcModuleTemplate.cs | 3 +-- .../Templates/ServiceTemplate.cs | 17 +++++++++++++++++ .../Building/Steps/NugetReferenceReplaceStep.cs | 9 ++++++++- .../SolutionTemplating/Github/GithubManager.cs | 2 +- .../SolutionTemplating/StandardVersions.cs | 1 + 7 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 abp_io/src/Volo.AbpWebSite.Web/Templates/ServiceTemplate.cs diff --git a/abp_io/src/Volo.AbpWebSite.Web/Pages/Templates.cshtml b/abp_io/src/Volo.AbpWebSite.Web/Pages/Templates.cshtml index c2617a2b31..b98dd60d67 100644 --- a/abp_io/src/Volo.AbpWebSite.Web/Pages/Templates.cshtml +++ b/abp_io/src/Volo.AbpWebSite.Web/Pages/Templates.cshtml @@ -32,6 +32,7 @@ diff --git a/abp_io/src/Volo.AbpWebSite.Web/Pages/Templates.cshtml.cs b/abp_io/src/Volo.AbpWebSite.Web/Pages/Templates.cshtml.cs index 8a5e321143..7e4228998c 100644 --- a/abp_io/src/Volo.AbpWebSite.Web/Pages/Templates.cshtml.cs +++ b/abp_io/src/Volo.AbpWebSite.Web/Pages/Templates.cshtml.cs @@ -63,6 +63,9 @@ namespace Volo.AbpWebSite.Pages case "MvcModule": DatabaseProvider = DatabaseProvider.Irrelevant; return new MvcModuleTemplate(_configurationAccessor.Configuration); + case "Service": + DatabaseProvider = DatabaseProvider.Irrelevant; + return new ServiceTemplate(_configurationAccessor.Configuration); case "MvcApp": default: return new MvcApplicationTemplate(_configurationAccessor.Configuration); diff --git a/abp_io/src/Volo.AbpWebSite.Web/Templates/MvcModuleTemplate.cs b/abp_io/src/Volo.AbpWebSite.Web/Templates/MvcModuleTemplate.cs index 6438612c98..c477386446 100644 --- a/abp_io/src/Volo.AbpWebSite.Web/Templates/MvcModuleTemplate.cs +++ b/abp_io/src/Volo.AbpWebSite.Web/Templates/MvcModuleTemplate.cs @@ -1,5 +1,4 @@ - -using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration; using Volo.Utils.SolutionTemplating.Building; namespace Volo.AbpWebSite.Templates diff --git a/abp_io/src/Volo.AbpWebSite.Web/Templates/ServiceTemplate.cs b/abp_io/src/Volo.AbpWebSite.Web/Templates/ServiceTemplate.cs new file mode 100644 index 0000000000..2396601074 --- /dev/null +++ b/abp_io/src/Volo.AbpWebSite.Web/Templates/ServiceTemplate.cs @@ -0,0 +1,17 @@ +using Microsoft.Extensions.Configuration; +using Volo.Utils.SolutionTemplating.Building; + +namespace Volo.AbpWebSite.Templates +{ + public class ServiceTemplate : TemplateInfo + { + public ServiceTemplate(IConfigurationRoot configuration) + : base( + "abp-service", + new GithubRepositoryInfo("abpframework/abp", configuration["GithubAccessToken"]), + "/templates/service") + { + + } + } +} \ No newline at end of file diff --git a/abp_io/src/Volo.Utils.SolutionTemplating/Volo/Utils/SolutionTemplating/Building/Steps/NugetReferenceReplaceStep.cs b/abp_io/src/Volo.Utils.SolutionTemplating/Volo/Utils/SolutionTemplating/Building/Steps/NugetReferenceReplaceStep.cs index 5685567c47..25cdbc988e 100644 --- a/abp_io/src/Volo.Utils.SolutionTemplating/Volo/Utils/SolutionTemplating/Building/Steps/NugetReferenceReplaceStep.cs +++ b/abp_io/src/Volo.Utils.SolutionTemplating/Volo/Utils/SolutionTemplating/Building/Steps/NugetReferenceReplaceStep.cs @@ -54,7 +54,14 @@ namespace Volo.Utils.SolutionTemplating.Building.Steps doc.Load(GenerateStreamFromString(content)); - return ProcessReferenceNodes(doc.DocumentNode.SelectNodes("//projectreference[@include]"), content); + var nodes = doc.DocumentNode.SelectNodes("//projectreference[@include]"); + + if (nodes == null) + { + return content; + } + + return ProcessReferenceNodes(nodes, content); } private string ProcessReferenceNodes(HtmlNodeCollection nodes, string content) diff --git a/abp_io/src/Volo.Utils.SolutionTemplating/Volo/Utils/SolutionTemplating/Github/GithubManager.cs b/abp_io/src/Volo.Utils.SolutionTemplating/Volo/Utils/SolutionTemplating/Github/GithubManager.cs index 1f68460232..953329245e 100644 --- a/abp_io/src/Volo.Utils.SolutionTemplating/Volo/Utils/SolutionTemplating/Github/GithubManager.cs +++ b/abp_io/src/Volo.Utils.SolutionTemplating/Volo/Utils/SolutionTemplating/Github/GithubManager.cs @@ -15,7 +15,7 @@ namespace Volo.Utils.SolutionTemplating.Github public string GetVersion(ProjectBuildContext context) { - if (context.Request.Version.StartsWith("Branch:")) + if (context.Request.Version.StartsWith("Branch:", StringComparison.OrdinalIgnoreCase)) { //TODO: Should not cache branch files! return context.Request.Version.Substring("Branch:".Length); diff --git a/abp_io/src/Volo.Utils.SolutionTemplating/Volo/Utils/SolutionTemplating/StandardVersions.cs b/abp_io/src/Volo.Utils.SolutionTemplating/Volo/Utils/SolutionTemplating/StandardVersions.cs index 883bbb6290..e2c7d0898f 100644 --- a/abp_io/src/Volo.Utils.SolutionTemplating/Volo/Utils/SolutionTemplating/StandardVersions.cs +++ b/abp_io/src/Volo.Utils.SolutionTemplating/Volo/Utils/SolutionTemplating/StandardVersions.cs @@ -3,6 +3,7 @@ public static class StandardVersions { public const string LatestStable = "LatestStable"; + public const string LatestUnstable = "LatestUnstable"; } }