From fa9a12ad499abcb7814155c9077c35441a02c09f Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Fri, 29 Jul 2022 09:06:59 +0100 Subject: [PATCH] WIP Page leaf --- .gitignore | 2 ++ .vscode/settings.json | 2 +- src/isnd/Controllers/Packages/Catalog.cs | 9 +++++---- src/isnd/Services/PackageManager.cs | 12 +++++++++++- src/isnd/Startup.cs | 3 ++- test/data/test-isn/NuGet.Config | 8 ++++++++ test/data/test-isn/Program.cs | 2 ++ test/data/test-isn/isn-test.sh | 4 ++++ test/data/test-isn/test-isn.csproj | 11 +++++++++++ test/data/test-isn/testcmd | 1 + 10 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 test/data/test-isn/NuGet.Config create mode 100644 test/data/test-isn/Program.cs create mode 100755 test/data/test-isn/isn-test.sh create mode 100644 test/data/test-isn/test-isn.csproj create mode 100644 test/data/test-isn/testcmd diff --git a/.gitignore b/.gitignore index 908e9f6..9ee2cc0 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ appsettings.Development.json /src/isn.abst/bin /src/isn.abst/obj /src/isnd/packages/ +test/data/test-isn/bin/ +test/data/test-isn/obj diff --git a/.vscode/settings.json b/.vscode/settings.json index 12b34b3..5832ced 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,6 @@ { "omnisharp.msbuild": true, - "dotnet-test-explorer.testProjectPath": "**/*Tests.csproj", + "dotnet-test-explorer.testProjectPath": "**/*tests.csproj", "dotnet-test-explorer.runInParallel": false, "dotnet-test-explorer.showCodeLens": true, "dotnet-test-explorer.testArguments": "", diff --git a/src/isnd/Controllers/Packages/Catalog.cs b/src/isnd/Controllers/Packages/Catalog.cs index dfa303e..563068f 100644 --- a/src/isnd/Controllers/Packages/Catalog.cs +++ b/src/isnd/Controllers/Packages/Catalog.cs @@ -50,15 +50,16 @@ namespace isnd.Controllers if (pkgvs.Count() == 0) return NotFound(); - List types = pkgvs.Select( + List types = pkgvs + .Select( v => v.Type ?? "Dependency" - ).Distinct().ToList(); + ) + .Distinct().ToList(); if (!types.Contains("PackageDelete")) types.Add("PackageDetails"); var last = pkgvs.Last(); - var pub = last.Package.CommitTimeStamp; - var firstpub = pkgvs.First().Package.CommitTimeStamp; + var pub = last.LatestCommit.CommitTimeStamp; return Ok(new Data.Packages.Catalog.CatalogLeaf { diff --git a/src/isnd/Services/PackageManager.cs b/src/isnd/Services/PackageManager.cs index d0cd9e4..fdd10be 100644 --- a/src/isnd/Services/PackageManager.cs +++ b/src/isnd/Services/PackageManager.cs @@ -127,6 +127,7 @@ namespace isnd.Services { var scope = dbContext.Packages + .Include(p=>p.Versions) .Where( p => (PackageIdHelpers.CamelCaseMatch(p.Id, query) || PackageIdHelpers.SeparatedByMinusMatch(p.Id, query)) && (prerelease || p.Versions.Any(v => !v.IsPrerelease)) @@ -134,14 +135,22 @@ namespace isnd.Services ); var total = scope.Count(); var pkgs = scope.Skip(skip).Take(take).ToArray(); - + return new PackageIndexViewModel { Query = query, TotalHits = total, Data = pkgs }; + } + + private object PackageVersionToRegentry(Package v) + { + return new { + + }; } + public AutoCompleteResult AutoComplete(string id, int skip, int take, bool prerelease = false, string packageType = null) @@ -332,6 +341,7 @@ namespace isnd.Services { return dbContext.PackageVersions .Include(v => v.Package) + .Include(v => v.LatestCommit) .Where(v => v.PackageId == id && v.FullString == version && (lower == null || lower == v.Type)); } diff --git a/src/isnd/Startup.cs b/src/isnd/Startup.cs index 26fbd3c..af856bb 100644 --- a/src/isnd/Startup.cs +++ b/src/isnd/Startup.cs @@ -110,7 +110,8 @@ namespace isnd ApplicationDbContext dbContext) { app.UseForwardedHeaders(); - // if have a cert : app.UseHttpsRedirection(); + // Not using Apache cert : + // app.UseHttpsRedirection(); if (env.IsDevelopment()) { diff --git a/test/data/test-isn/NuGet.Config b/test/data/test-isn/NuGet.Config new file mode 100644 index 0000000..293c2f9 --- /dev/null +++ b/test/data/test-isn/NuGet.Config @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/test/data/test-isn/Program.cs b/test/data/test-isn/Program.cs new file mode 100644 index 0000000..83fa4f4 --- /dev/null +++ b/test/data/test-isn/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/test/data/test-isn/isn-test.sh b/test/data/test-isn/isn-test.sh new file mode 100755 index 0000000..5aceab2 --- /dev/null +++ b/test/data/test-isn/isn-test.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +nuget locals all -clear && dotnet nuget locals all --clear && nuget add Yavsc.Abstract -Config NuGet.Config -Source isn-dev + diff --git a/test/data/test-isn/test-isn.csproj b/test/data/test-isn/test-isn.csproj new file mode 100644 index 0000000..f1077df --- /dev/null +++ b/test/data/test-isn/test-isn.csproj @@ -0,0 +1,11 @@ + + + + Exe + net6.0 + test_isn + enable + enable + + + diff --git a/test/data/test-isn/testcmd b/test/data/test-isn/testcmd new file mode 100644 index 0000000..157e034 --- /dev/null +++ b/test/data/test-isn/testcmd @@ -0,0 +1 @@ +nuget install -NoCache -Verbosity detailed -ConfigFile NuGet.Config Yavsc.Abstract