Skip to content

Commit

Permalink
Update templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaliumhexacyanoferrat committed Jan 8, 2024
1 parent 74dddd9 commit 5eb8abc
Show file tree
Hide file tree
Showing 20 changed files with 391 additions and 110 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>

<TargetFramework>net8.0</TargetFramework>

<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

<IsPackable>false</IsPackable>

</PropertyGroup>

<ItemGroup>

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />

<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />

<PackageReference Include="GenHTTP.Testing" Version="8.1.0" />

<ProjectReference Include="..\$safeprojectname$\$safeprojectname$.csproj" />

</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Net;
using System.Threading.Tasks;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using GenHTTP.Testing;

namespace $safeprojectname$.Tests
{

[TestClass]
public class BookControllerTests
{

[TestMethod]
public async Task TestCanFetchBooks()
{
using var runner = TestHost.Run(Project.Create());

using var response = await runner.GetResponseAsync("/books/");

Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@

<ItemGroup>

<PackageReference Include="GenHTTP.Core" Version="8.0.0" />
<PackageReference Include="GenHTTP.Core" Version="8.1.0" />

<PackageReference Include="GenHTTP.Modules.Websites" Version="8.0.0" />
<PackageReference Include="GenHTTP.Modules.Controllers" Version="8.0.0" />
<PackageReference Include="GenHTTP.Modules.Websites" Version="8.1.0" />
<PackageReference Include="GenHTTP.Modules.Controllers" Version="8.1.0" />

<PackageReference Include="GenHTTP.Modules.Razor" Version="8.0.0" />
<PackageReference Include="GenHTTP.Modules.Markdown" Version="8.0.0" />
<PackageReference Include="GenHTTP.Modules.Razor" Version="8.1.0" />
<PackageReference Include="GenHTTP.Modules.Markdown" Version="8.1.0" />

<PackageReference Include="GenHTTP.Themes.AdminLTE" Version="8.0.0" />

Expand Down
35 changes: 2 additions & 33 deletions Templates/Website-MVC-Razor/$safeprojectname$/Program.cs
Original file line number Diff line number Diff line change
@@ -1,42 +1,11 @@
using GenHTTP.Engine;

using GenHTTP.Modules.Controllers;
using GenHTTP.Modules.IO;
using GenHTTP.Modules.Layouting;
using GenHTTP.Modules.Markdown;
using GenHTTP.Modules.Practices;
using GenHTTP.Modules.Websites;

using GenHTTP.Themes.AdminLTE;

using $safeprojectname$.Controllers;

var index = ModMarkdown.Page(Resource.FromAssembly("Home.md"))
.Title("Home");

var resources = Resources.From(ResourceTree.FromAssembly("Static"));

var app = Layout.Create()
.AddController<BookController>("books")
.Index(index)
.Add("static", resources);

var theme = Theme.Create()
.Title("Book Manager");

var menu = Menu.Empty()
.Add("{website}", "Home")
.Add("/books/", "Books");

var website = Website.Create()
.Theme(theme)
.Menu(menu)
.Content(app)
.AddScript("custom.js", Resource.FromAssembly("custom.js"))
.AddStyle("custom.css", Resource.FromAssembly("custom.css"));
using $safeprojectname$;

return Host.Create()
.Handler(website)
.Handler(Project.Create())
.Defaults()
.Console()
//-:cnd:noEmit
Expand Down
50 changes: 50 additions & 0 deletions Templates/Website-MVC-Razor/$safeprojectname$/Project.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using GenHTTP.Api.Content;

using GenHTTP.Modules.Controllers;
using GenHTTP.Modules.IO;
using GenHTTP.Modules.Layouting;
using GenHTTP.Modules.Markdown;
using GenHTTP.Modules.Websites;

using GenHTTP.Themes.AdminLTE;

using $safeprojectname$.Controllers;

namespace $safeprojectname$
{

public static class Project
{

public static IHandlerBuilder Create()
{
var index = ModMarkdown.Page(Resource.FromAssembly("Home.md"))
.Title("Home");

var resources = Resources.From(ResourceTree.FromAssembly("Static"));

var app = Layout.Create()
.AddController<BookController>("books")
.Index(index)
.Add("static", resources);

var theme = Theme.Create()
.Title("Book Manager");

var menu = Menu.Empty()
.Add("{website}", "Home")
.Add("/books/", "Books");

var website = Website.Create()
.Theme(theme)
.Menu(menu)
.Content(app)
.AddScript("custom.js", Resource.FromAssembly("custom.js"))
.AddStyle("custom.css", Resource.FromAssembly("custom.css"));

return website;
}

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>

<TargetFramework>net8.0</TargetFramework>

<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

<IsPackable>false</IsPackable>

</PropertyGroup>

<ItemGroup>

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />

<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />

<PackageReference Include="GenHTTP.Testing" Version="8.1.0" />

<ProjectReference Include="..\$safeprojectname$\$safeprojectname$.csproj" />

</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Net;
using System.Threading.Tasks;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using GenHTTP.Testing;

namespace $safeprojectname$.Tests
{

[TestClass]
public class BookControllerTests
{

[TestMethod]
public async Task TestCanFetchBooks()
{
using var runner = TestHost.Run(Project.Create());

using var response = await runner.GetResponseAsync("/books/");

Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@

<ItemGroup>

<PackageReference Include="GenHTTP.Core" Version="8.0.0" />
<PackageReference Include="GenHTTP.Core" Version="8.1.0" />

<PackageReference Include="GenHTTP.Modules.Websites" Version="8.0.0" />
<PackageReference Include="GenHTTP.Modules.Controllers" Version="8.0.0" />
<PackageReference Include="GenHTTP.Modules.Websites" Version="8.1.0" />
<PackageReference Include="GenHTTP.Modules.Controllers" Version="8.1.0" />

<PackageReference Include="GenHTTP.Modules.Scriban" Version="8.0.0" />
<PackageReference Include="GenHTTP.Modules.Markdown" Version="8.0.0" />
<PackageReference Include="GenHTTP.Modules.Scriban" Version="8.1.0" />
<PackageReference Include="GenHTTP.Modules.Markdown" Version="8.1.0" />

<PackageReference Include="GenHTTP.Themes.AdminLTE" Version="8.0.0" />

Expand Down
35 changes: 2 additions & 33 deletions Templates/Website-MVC-Scriban/$safeprojectname$/Program.cs
Original file line number Diff line number Diff line change
@@ -1,42 +1,11 @@
using GenHTTP.Engine;

using GenHTTP.Modules.Controllers;
using GenHTTP.Modules.IO;
using GenHTTP.Modules.Layouting;
using GenHTTP.Modules.Markdown;
using GenHTTP.Modules.Practices;
using GenHTTP.Modules.Websites;

using GenHTTP.Themes.AdminLTE;

using $safeprojectname$.Controllers;

var index = ModMarkdown.Page(Resource.FromAssembly("Home.md"))
.Title("Home");

var resources = Resources.From(ResourceTree.FromAssembly("Static"));

var app = Layout.Create()
.AddController<BookController>("books")
.Index(index)
.Add("static", resources);

var theme = Theme.Create()
.Title("Book Manager");

var menu = Menu.Empty()
.Add("{website}", "Home")
.Add("/books/", "Books");

var website = Website.Create()
.Theme(theme)
.Menu(menu)
.Content(app)
.AddScript("custom.js", Resource.FromAssembly("custom.js"))
.AddStyle("custom.css", Resource.FromAssembly("custom.css"));
using $safeprojectname$;

return Host.Create()
.Handler(website)
.Handler(Project.Create())
.Defaults()
.Console()
//-:cnd:noEmit
Expand Down
50 changes: 50 additions & 0 deletions Templates/Website-MVC-Scriban/$safeprojectname$/Project.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using GenHTTP.Api.Content;

using GenHTTP.Modules.Controllers;
using GenHTTP.Modules.IO;
using GenHTTP.Modules.Layouting;
using GenHTTP.Modules.Markdown;
using GenHTTP.Modules.Websites;

using GenHTTP.Themes.AdminLTE;

using $safeprojectname$.Controllers;

namespace $safeprojectname$
{

public static class Project
{

public static IHandlerBuilder Create()
{
var index = ModMarkdown.Page(Resource.FromAssembly("Home.md"))
.Title("Home");

var resources = Resources.From(ResourceTree.FromAssembly("Static"));

var app = Layout.Create()
.AddController<BookController>("books")
.Index(index)
.Add("static", resources);

var theme = Theme.Create()
.Title("Book Manager");

var menu = Menu.Empty()
.Add("{website}", "Home")
.Add("/books/", "Books");

var website = Website.Create()
.Theme(theme)
.Menu(menu)
.Content(app)
.AddScript("custom.js", Resource.FromAssembly("custom.js"))
.AddStyle("custom.css", Resource.FromAssembly("custom.css"));

return website;
}

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>

<TargetFramework>net8.0</TargetFramework>

<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

<IsPackable>false</IsPackable>

</PropertyGroup>

<ItemGroup>

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />

<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />

<PackageReference Include="GenHTTP.Testing" Version="8.1.0" />

<ProjectReference Include="..\$safeprojectname$\$safeprojectname$.csproj" />

</ItemGroup>

</Project>
Loading

0 comments on commit 5eb8abc

Please sign in to comment.