rename project, sln
This commit is contained in:
Родитель
cf56b1dcdc
Коммит
f411910a8c
|
@ -3,9 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28307.329
|
||||
MinimumVisualStudioVersion = 15.0.26124.0
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InitializrApiTests", "tests\InitializrApiTests.csproj", "{E1CCB76F-904D-4B24-BF5F-B3B7DF9897C9}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Steeltoe.Initializr.Tests", "tests\Steeltoe.Initializr.Tests.csproj", "{E1CCB76F-904D-4B24-BF5F-B3B7DF9897C9}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InitializrApi", "src\InitializrApi.csproj", "{945A8C33-08A6-4D07-A3B6-51D7802A4DC0}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Steeltoe.Initializr", "src\Steeltoe.Initializr.csproj", "{945A8C33-08A6-4D07-A3B6-51D7802A4DC0}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config", "config", "{42A583D3-DB7F-49E9-A89B-58FE16391C6C}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
shared.props = shared.props
|
||||
stylecop.json = stylecop.json
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
@ -0,0 +1,11 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<NoWarn>SA1101;SA1124;SA1201;SA1309;SA1310;SA1401;SA1600;SA1652;1591;CS8002</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Include="../stylecop.json">
|
||||
<Link>stylecop.json</Link>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</AdditionalFiles>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,36 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using InitializrApi.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using testDir.Models;
|
||||
|
||||
namespace InitializrApi.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
ISteeltoeTemplateService _templateService;
|
||||
public HomeController(ISteeltoeTemplateService templateService)
|
||||
{
|
||||
_templateService = templateService;
|
||||
}
|
||||
//[Route("/all")]
|
||||
//public IActionResult Index()
|
||||
//{
|
||||
// var templates = _templateService.GetAvailableTemplates();
|
||||
// if (Request.Headers["Accept"].Any(x => x.Contains("text/html")))
|
||||
// {
|
||||
// ViewData.Model = templates;
|
||||
// return View();
|
||||
// }
|
||||
|
||||
// else
|
||||
// {
|
||||
// return Content("Hi result");
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
|
@ -1,3 +1,17 @@
|
|||
// Copyright 2017 the original author or authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
@ -18,10 +32,10 @@ using Microsoft.TemplateEngine.Edge.Settings;
|
|||
using Microsoft.TemplateEngine.Edge.Template;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using System.Text;
|
||||
using InitializrApi.Models;
|
||||
using InitializrApi.Services;
|
||||
using Steeltoe.Initializr.Models;
|
||||
using Steeltoe.Initializr.Services;
|
||||
|
||||
namespace InitializrApi.Controllers
|
||||
namespace Steeltoe.Initializr.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
|
@ -54,39 +68,10 @@ namespace InitializrApi.Controllers
|
|||
[Route("/createtest")]
|
||||
public ActionResult GenerateProjectTest([FromQuery(Name = "templateShortName")] string templateShortName)
|
||||
{
|
||||
return GenerateProject(new GeneratorModel { templateShortName = templateShortName ?? DEFAULT_TEMPLATE, projectName = "mytest", dependencies = new[] { "actuators,mysql" } }); ;
|
||||
return GenerateProject(new GeneratorModel { TemplateShortName = templateShortName ?? DEFAULT_TEMPLATE, ProjectName = "mytest", Dependencies = new[] { "actuators,mysql" } }); ;
|
||||
}
|
||||
|
||||
private ActionResult GenerateProject(GeneratorModel model)
|
||||
{
|
||||
//var form = Request.Form;
|
||||
var list = _templateService.GetAvailableTemplates();
|
||||
var currentTemplate = (model.templateShortName ?? DEFAULT_TEMPLATE).ToLower();
|
||||
|
||||
|
||||
if (list == null || !list.Any(x => x.ShortName.ToLower() == currentTemplate))
|
||||
{
|
||||
return NotFound($"Template {currentTemplate} was not found");
|
||||
}
|
||||
var templateParameters = model.dependencies.ToList();
|
||||
if(!string.IsNullOrEmpty(model.steeltoeVersion))
|
||||
{
|
||||
templateParameters.Add($"SteeltoeVersion={model.steeltoeVersion}");
|
||||
}
|
||||
string outFolder = _templateService.GenerateProject(currentTemplate, model.projectName, templateParameters.ToArray() ).Result;
|
||||
var zipName = (model.projectName ?? "steeltoeProject")+".zip";
|
||||
|
||||
var zipFile = Path.Combine(outFolder,"..", zipName);
|
||||
ZipFile.CreateFromDirectory(outFolder, zipFile);
|
||||
|
||||
var cd = new ContentDispositionHeaderValue("attachment")
|
||||
{
|
||||
FileNameStar = zipName
|
||||
};
|
||||
Response.Headers.Add("Content-Disposition", cd.ToString());
|
||||
return File(System.IO.File.ReadAllBytes(zipFile), "application/zip");
|
||||
|
||||
}
|
||||
|
||||
// GET api/templates
|
||||
[Route("/dependencies")]
|
||||
public ActionResult GetDependencies()
|
||||
|
@ -99,14 +84,52 @@ namespace InitializrApi.Controllers
|
|||
{
|
||||
return _templateService.GetAvailableTemplates();
|
||||
}
|
||||
|
||||
[Route("stall")]
|
||||
public ActionResult<IEnumerable<string>> GetSteeltoeTemplates()
|
||||
{
|
||||
return _sttemplateService.GetAvailableTemplates();
|
||||
}
|
||||
|
||||
|
||||
private ActionResult GenerateProject(GeneratorModel model)
|
||||
{
|
||||
//var form = Request.Form;
|
||||
var list = _templateService.GetAvailableTemplates();
|
||||
var currentTemplate = (model.TemplateShortName ?? DEFAULT_TEMPLATE).ToLower();
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (list == null || !list.Any(x => x.ShortName.ToLower() == currentTemplate))
|
||||
{
|
||||
return NotFound($"Template {currentTemplate} was not found");
|
||||
}
|
||||
var templateParameters = model.Dependencies.ToList();
|
||||
|
||||
if (!string.IsNullOrEmpty(model.SteeltoeVersion))
|
||||
{
|
||||
if (model.SteeltoeVersion == "3.0")
|
||||
{
|
||||
currentTemplate = "steeltoe";
|
||||
}
|
||||
else
|
||||
{
|
||||
templateParameters.Add($"SteeltoeVersion={model.SteeltoeVersion}");
|
||||
}
|
||||
}
|
||||
|
||||
string outFolder = _templateService.GenerateProject(currentTemplate, model.ProjectName, templateParameters.ToArray()).Result;
|
||||
var zipName = (model.ProjectName ?? "steeltoeProject") + ".zip";
|
||||
|
||||
var zipFile = Path.Combine(outFolder, "..", zipName);
|
||||
ZipFile.CreateFromDirectory(outFolder, zipFile);
|
||||
|
||||
var cd = new ContentDispositionHeaderValue("attachment")
|
||||
{
|
||||
FileNameStar = zipName
|
||||
};
|
||||
Response.Headers.Add("Content-Disposition", cd.ToString());
|
||||
return File(System.IO.File.ReadAllBytes(zipFile), "application/zip");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Steeltoe.Initializr</name>
|
||||
</assembly>
|
||||
<members>
|
||||
</members>
|
||||
</doc>
|
|
@ -1,11 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace testDir.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
}
|
|
@ -1,23 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
// Copyright 2017 the original author or authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
namespace InitializrApi.Models
|
||||
namespace Steeltoe.Initializr.Models
|
||||
{
|
||||
public class GeneratorModel
|
||||
{
|
||||
private string[] _dependencies;
|
||||
|
||||
public string[] dependencies
|
||||
public string[] Dependencies
|
||||
{
|
||||
get => _dependencies;
|
||||
set => _dependencies = (value == null || value.Length == 0 || value[0] == null) ? value : value[0].ToLower().Split(',');
|
||||
}
|
||||
public string projectName { get; set; }
|
||||
public string templateShortName { get; set; }
|
||||
|
||||
public string description { get; set; }
|
||||
public string steeltoeVersion { get; set; }
|
||||
|
||||
public string ProjectName { get; set; }
|
||||
|
||||
public string TemplateShortName { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public string SteeltoeVersion { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InitializrApi.Models
|
||||
namespace Steeltoe.Initializr.Models
|
||||
{
|
||||
public class ProjectDependency
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InitializrApi.Models
|
||||
namespace Steeltoe.Initializr.Models
|
||||
{
|
||||
public class TemplateViewModel
|
||||
{
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
@page
|
||||
@model ErrorModel
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
|
@ -1,23 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace testDir.Pages
|
||||
{
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public class ErrorModel : PageModel
|
||||
{
|
||||
public string RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
@using testDir
|
||||
@namespace testDir.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
|
@ -9,7 +9,7 @@ using Microsoft.Extensions.Configuration;
|
|||
using Microsoft.Extensions.Logging;
|
||||
|
||||
|
||||
namespace InitializrApi
|
||||
namespace Steeltoe.Initializr
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"InitializrApi": {
|
||||
"Steeltoe.Initializr": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "https://localhost:5001/api/templates/all",
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using InitializrApi.Models;
|
||||
using Steeltoe.Initializr.Models;
|
||||
|
||||
namespace InitializrApi.Services
|
||||
namespace Steeltoe.Initializr.Services
|
||||
{
|
||||
public interface ITemplateService
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
@ -11,7 +11,7 @@ using Microsoft.TemplateEngine.Edge.Mount.Archive;
|
|||
using Microsoft.TemplateEngine.Edge.Mount.FileSystem;
|
||||
using Microsoft.TemplateEngine.Edge.Settings;
|
||||
|
||||
namespace InitializrApi.Services
|
||||
namespace Steeltoe.Initializr.Services
|
||||
{
|
||||
internal class InitializrComponentManager : IComponentManager
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ using Microsoft.TemplateEngine.Utils;
|
|||
using Newtonsoft.Json.Linq;
|
||||
|
||||
|
||||
namespace InitializrApi.Services
|
||||
namespace Steeltoe.Initializr.Services
|
||||
{
|
||||
public class InitializrSettingsLoader : ISettingsLoader
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace InitializrApi.Services
|
||||
namespace Steeltoe.Initializr.Services
|
||||
{
|
||||
public class InitializrTemplateCache
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@ using Microsoft.TemplateEngine.Abstractions.Mount;
|
|||
using Microsoft.TemplateEngine.Utils;
|
||||
|
||||
|
||||
namespace InitializrApi.Services
|
||||
namespace Steeltoe.Initializr.Services
|
||||
{
|
||||
internal class InitializrMountPointManager : IMountPointManager
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using InitializrApi.Models;
|
||||
using Steeltoe.Initializr.Models;
|
||||
using Microsoft.TemplateEngine.Abstractions;
|
||||
using Microsoft.TemplateEngine.Cli;
|
||||
using Microsoft.TemplateEngine.Cli.PostActionProcessors;
|
||||
|
@ -16,7 +16,7 @@ using Microsoft.TemplateEngine.Edge.TemplateUpdates;
|
|||
using Microsoft.TemplateEngine.Orchestrator.RunnableProjects;
|
||||
using Microsoft.TemplateEngine.Utils;
|
||||
|
||||
namespace InitializrApi.Services
|
||||
namespace Steeltoe.Initializr.Services
|
||||
{
|
||||
public class TemplateService : ITemplateService
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using InitializrApi.Services;
|
||||
using Steeltoe.Initializr.Services;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
@ -8,7 +8,7 @@ using Microsoft.Extensions.Configuration;
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace InitializrApi
|
||||
namespace Steeltoe.Initializr
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<Import Project="..\shared.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
||||
|
@ -13,6 +13,9 @@
|
|||
<UserSecretsId>.zip</UserSecretsId>
|
||||
|
||||
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DocumentationFile>C:\Users\Hananiel\projects\InitializrApi\src\InitializrApi.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<!-- Don't publish the SPA source files, but do show them in the project files list -->
|
||||
|
@ -46,6 +49,10 @@
|
|||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<PackageReference Include="Stubble.Core" Version="1.2.7" />
|
||||
<PackageReference Include="Stubble.Extensions.JsonNet" Version="1.0.18" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using InitializrApi.Models;
|
||||
using Steeltoe.Initializr.Models;
|
||||
|
||||
namespace InitializrApi.Services
|
||||
namespace Steeltoe.Initializr.Services
|
||||
{
|
||||
public interface ISteeltoeTemplateService
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using InitializrApi.Models;
|
||||
using Steeltoe.Initializr.Models;
|
||||
using Newtonsoft.Json;
|
||||
using Stubble.Core;
|
||||
using Stubble.Core.Builders;
|
||||
|
@ -11,7 +11,7 @@ using System.Text;
|
|||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
|
||||
namespace InitializrApi.Services
|
||||
namespace Steeltoe.Initializr.Services
|
||||
{
|
||||
public class SteeltoeTemplateService : ISteeltoeTemplateService
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ namespace InitializrApi.Services
|
|||
var templatePath = Path.Combine(current, "SteeltoeTemplates", "templates", name);
|
||||
var json = File.ReadAllText(Path.Combine(templatePath, "mustache.json"));
|
||||
var dataView = JsonConvert.DeserializeObject<Dictionary<string, string>>(json);
|
||||
foreach(var dependency in model.dependencies)
|
||||
foreach(var dependency in model.Dependencies)
|
||||
{
|
||||
if(dataView.ContainsKey(dependency))
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@ applications:
|
|||
buildpacks:
|
||||
- dotnet_core_buildpack
|
||||
memory: 512M
|
||||
command: cd ${HOME} && ./InitializrApi
|
||||
command: cd ${HOME} && ./Steeltoe.Initializr
|
||||
env:
|
||||
ASPNETCORE_ENVIRONMENT: Production
|
||||
services:
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
|
||||
"settings": {
|
||||
"documentationRules": {
|
||||
"copyrightText": "Copyright {copyrightYear} the original author or authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttps://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.",
|
||||
"xmlHeader": false,
|
||||
"variables": {
|
||||
"copyrightYear": "2017"
|
||||
},
|
||||
"documentExposedElements": false,
|
||||
"documentInternalElements": false,
|
||||
"documentPrivateElements": false
|
||||
},
|
||||
"indentation": {
|
||||
"useTabs": false,
|
||||
"indentationSize": 4
|
||||
},
|
||||
"namingRules": {
|
||||
},
|
||||
"orderingRules": {
|
||||
"usingDirectivesPlacement": "outsideNamespace",
|
||||
"systemUsingDirectivesFirst": false
|
||||
},
|
||||
"readabilityRules": {
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,9 +21,7 @@ using Microsoft.Extensions.Configuration;
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
#if (MSSql)
|
||||
using Steeltoe.CloudFoundry.Connector.MySql;
|
||||
#endif
|
||||
|
||||
#if(Actuators || CloudFoundry)
|
||||
using Steeltoe.Management.CloudFoundry;
|
||||
using Steeltoe.Management.Endpoint;
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
"ac33c6a1-52ca-4215-b72d-2dce7f6a1d2f": "Microsoft.TemplateEngine.Edge.TemplateUpdates.NupkgInstallUnitDescriptorFactory, Microsoft.TemplateEngine.Edge, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
|
||||
},
|
||||
"ProbingPaths": [
|
||||
"C:\\Users\\Hananiel\\projects\\InitializrApi\\templates\\content"
|
||||
"C:\\Users\\Hananiel\\projects\\Steeltoe.Initializr\\templates\\content"
|
||||
],
|
||||
"ComponentTypeToGuidList": {
|
||||
"Microsoft.TemplateEngine.Abstractions.IGenerator, Microsoft.TemplateEngine.Abstractions, Version=1.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60": [
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"ParentMountPointId": "00000000-0000-0000-0000-000000000000",
|
||||
"MountPointFactoryId": "8c19221b-dea3-4250-86fe-2d4e189a11d2",
|
||||
"MountPointId": "1815274a-f735-4189-9f1c-cbc16a31dd3a",
|
||||
"Place": "C:\\Users\\Hananiel\\projects\\InitializrApi\\templates\\Steeltoe-CSharp-2.2"
|
||||
"Place": "C:\\Users\\Hananiel\\projects\\Steeltoe.Initializr\\templates\\Steeltoe-CSharp-2.2"
|
||||
}
|
||||
],
|
||||
"ComponentGuidToAssemblyQualifiedName": {
|
||||
|
@ -39,7 +39,7 @@
|
|||
"ac33c6a1-52ca-4215-b72d-2dce7f6a1d2f": "Microsoft.TemplateEngine.Edge.TemplateUpdates.NupkgInstallUnitDescriptorFactory, Microsoft.TemplateEngine.Edge, Version=42.42.42.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
|
||||
},
|
||||
"ProbingPaths": [
|
||||
"C:\\Users\\Hananiel\\projects\\InitializrApi\\templates\\content"
|
||||
"C:\\Users\\Hananiel\\projects\\Steeltoe.Initializr\\templates\\content"
|
||||
],
|
||||
"ComponentTypeToGuidList": {
|
||||
"Microsoft.TemplateEngine.Abstractions.IGenerator, Microsoft.TemplateEngine.Abstractions, Version=1.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60": [
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\src\InitializrApi.csproj" />
|
||||
<ProjectReference Include="..\src\Steeltoe.Initializr.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="CopyTemplates" BeforeTargets="PreBuildEvent">
|
|
@ -1,11 +1,11 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using InitializrApi.Models;
|
||||
using InitializrApi.Services;
|
||||
using Steeltoe.Initializr.Models;
|
||||
using Steeltoe.Initializr.Services;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace InitializrApiTests
|
||||
namespace Steeltoe.InitializrTests
|
||||
{
|
||||
public class TemplateServiceTests: XunitLoggingBase
|
||||
{
|
||||
|
@ -135,6 +135,25 @@ namespace InitializrApiTests
|
|||
Assert.DoesNotContain("services.AddCloudFoundryActuators(Configuration, MediaTypeVersion.V2, ActuatorContext.ActuatorAndCloudFoundry);", startUpContents);
|
||||
Assert.Contains("services.AddCloudFoundryActuators(Configuration);", startUpContents);
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CreateTemplate_actuators_v3()
|
||||
{
|
||||
var templateService = new TemplateService();
|
||||
|
||||
Assert.NotNull(templateService);
|
||||
|
||||
var outFolder = templateService.GenerateProject("steeltoe", "testProject", new[] { "Actuators", "SteeltoeVersion=2.1.0" }).Result;
|
||||
Console.WriteLine("outFolder " + outFolder);
|
||||
Assert.NotNull(outFolder);
|
||||
Assert.True(Directory.Exists(outFolder));
|
||||
var startupPath = Path.Combine(outFolder, "Startup.cs");
|
||||
Assert.True(File.Exists(startupPath));
|
||||
string startUpContents = File.ReadAllText(startupPath);
|
||||
Assert.Contains("services.AddCloudFoundryActuators(Configuration, MediaTypeVersion.V2, ActuatorContext.ActuatorAndCloudFoundry);", startUpContents);
|
||||
Assert.DoesNotContain("services.AddCloudFoundryActuators(Configuration);", startUpContents);
|
||||
|
||||
}
|
||||
[Fact]
|
||||
public void CreateTemplate_empty()
|
||||
|
|
Загрузка…
Ссылка в новой задаче