Add daemon/web functionality
This commit is contained in:
parent
b2e35ba301
commit
39e1728edd
|
@ -1,10 +1,52 @@
|
|||
@page
|
||||
@model IndexModel
|
||||
@{
|
||||
ViewData["Title"] = "Home page";
|
||||
ViewData["Title"] = "Builds";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
<h1 class="display-4">Builds</h1>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Package</th>
|
||||
<th scope="col">Version</th>
|
||||
<th scope="col">Build status</th>
|
||||
<th scope="col">Log</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var p in Program.Repo._repo.Packages.OrderBy(p => p.Name))
|
||||
{
|
||||
<tr>
|
||||
<th scope="row">@p.Name</th>
|
||||
@if (p.CurrentVersion == p.RepoVersion)
|
||||
{
|
||||
<td><span class="badge badge-success">up-to-date</span> <span class="badge badge-info">@p.RepoVersion</span></td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td><span class="badge badge-warning">pending update</span> <span class="badge badge-danger">@p.RepoVersion</span> <span class="badge badge-secondary">@p.CurrentVersion</span></td>
|
||||
}
|
||||
@if (p.LastBuildSucceeded)
|
||||
{
|
||||
<td><span class="badge badge-success">Build passing</span></td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td><span class="badge badge-danger">Build failing</span></td>
|
||||
}
|
||||
@if (System.IO.File.Exists(System.IO.Path.Combine(Program.Repo._pkgpath, p.Name, "buildlog.txt")))
|
||||
{
|
||||
<td><a type="button" class="btn btn-sm btn-info" target="_blank" href="/Log?package=@p.Name">View Build log</a></td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>no logfile found</td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
|
@ -0,0 +1,23 @@
|
|||
@page
|
||||
@model repomgr.Pages.Log
|
||||
|
||||
@{
|
||||
Layout = null;
|
||||
Response.Headers["Content-Type"] = "text/plain";
|
||||
if (Program.Repo._repo.Packages.Any(p => p.Name.Equals(Request.Query["package"])))
|
||||
{
|
||||
var logfile = System.IO.Path.Combine(Program.Repo._pkgpath, Request.Query["package"], "buildlog.txt");
|
||||
if (System.IO.File.Exists(logfile))
|
||||
{
|
||||
@Html.Raw(System.IO.File.ReadAllText(logfile))
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.Raw("Package exists but no logfile found")
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.Raw("Package not found")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace repomgr.Pages
|
||||
{
|
||||
public class Log : PageModel
|
||||
{
|
||||
public void OnGet()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
@page
|
||||
@model PrivacyModel
|
||||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
}
|
||||
<h1>@ViewData["Title"]</h1>
|
||||
|
||||
<p>Use this page to detail your site's privacy policy.</p>
|
|
@ -1,16 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace repomgr.Pages
|
||||
{
|
||||
public class PrivacyModel : PageModel
|
||||
{
|
||||
public void OnGet()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
@using Microsoft.AspNetCore.Http.Features
|
||||
|
||||
@{
|
||||
var consentFeature = Context.Features.Get<ITrackingConsentFeature>();
|
||||
var showBanner = !consentFeature?.CanTrack ?? false;
|
||||
var cookieString = consentFeature?.CreateConsentCookie();
|
||||
}
|
||||
|
||||
@if (showBanner)
|
||||
{
|
||||
<div id="cookieConsent" class="alert alert-info alert-dismissible fade show" role="alert">
|
||||
Use this space to summarize your privacy and cookie use policy. <a asp-page="/Privacy">Learn More</a>.
|
||||
<button type="button" class="accept-policy close" data-dismiss="alert" aria-label="Close" data-cookie-string="@cookieString">
|
||||
<span aria-hidden="true">Accept</span>
|
||||
</button>
|
||||
</div>
|
||||
<script>
|
||||
(function () {
|
||||
var button = document.querySelector("#cookieConsent button[data-cookie-string]");
|
||||
button.addEventListener("click", function (event) {
|
||||
document.cookie = button.dataset.cookieString;
|
||||
}, false);
|
||||
})();
|
||||
</script>
|
||||
}
|
|
@ -31,16 +31,12 @@
|
|||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="container">
|
||||
<partial name="_CookieConsentPartial" />
|
||||
<main role="main" class="pb-3">
|
||||
@RenderBody()
|
||||
</main>
|
||||
|
@ -48,7 +44,7 @@
|
|||
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2019 - repomgr - <a asp-area="" asp-page="/Privacy">Privacy</a>
|
||||
© 2019 - repomgr
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ namespace repomgr
|
|||
Console.WriteLine("repomgr <data-path> remove <package>");
|
||||
Console.WriteLine("repomgr <data-path> update <package> [-f]");
|
||||
Console.WriteLine("repomgr <data-path> update-all");
|
||||
Console.WriteLine("repomgr <data-path> daemon"); //TODO
|
||||
Console.WriteLine("repomgr <data-path> daemon");
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,27 +1,14 @@
|
|||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:25107",
|
||||
"sslPort": 44336
|
||||
}
|
||||
},
|
||||
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"repomgr": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000",
|
||||
"launchBrowser": false,
|
||||
"applicationUrl": "http://localhost:5000",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"commandLineArgs": "/opt/repomgr daemon"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,9 +15,10 @@ namespace repomgr
|
|||
_buildpath = Path.GetFullPath(buildpath);
|
||||
_pkgpath = Path.Combine(_buildpath, "pkg");
|
||||
}
|
||||
|
||||
private readonly string _buildpath;
|
||||
private readonly string _pkgpath;
|
||||
private Repository _repo;
|
||||
public readonly string _pkgpath;
|
||||
public Repository _repo;
|
||||
public void Init(string repopath, string reponame)
|
||||
{
|
||||
_repo = new Repository(repopath, reponame);
|
||||
|
@ -113,7 +114,7 @@ namespace repomgr
|
|||
File.Copy(resultingPackage, Path.Combine(_repo.Path, Path.GetFileName(resultingPackage)), true);
|
||||
File.Delete(resultingPackage);
|
||||
package.PkgFiles.Add(Path.GetFileName(resultingPackage));
|
||||
Shell.Exec($"repo-add --remove --sign {_repo.Name}.db.tar.gz {Path.GetFileName(resultingPackage)} 2>&1| tee -a {Path.Combine(_buildpath, "repolog.txt")}", _repo.Path);
|
||||
Shell.Exec($"repo-add --remove --sign {_repo.Name}.db.tar.gz {Path.GetFileName(resultingPackage)}", _repo.Path);
|
||||
}
|
||||
package.RepoVersion = package.CurrentVersion;
|
||||
WriteIndex();
|
||||
|
@ -123,7 +124,7 @@ namespace repomgr
|
|||
var packageDir = Path.Combine(_pkgpath, package.Name);
|
||||
if (Directory.Exists(packageDir))
|
||||
Directory.Delete(packageDir, true);
|
||||
Shell.Exec($"repo-remove --sign {_repo.Name}.db.tar.gz {package.Name} 2>&1| tee -a {Path.Combine(_buildpath, "repolog.txt")}", _repo.Path);
|
||||
Shell.Exec($"repo-remove --sign {_repo.Name}.db.tar.gz {package.Name}", _repo.Path);
|
||||
if (package.PkgFiles.Any())
|
||||
{
|
||||
foreach (var pkgFile in package.PkgFiles)
|
||||
|
|
Loading…
Reference in New Issue