version bump & click fixes
This commit is contained in:
parent
3695c17429
commit
70f6e411e5
19 changed files with 82 additions and 42 deletions
6
.vscode/launch.json
vendored
6
.vscode/launch.json
vendored
|
|
@ -17,7 +17,11 @@
|
|||
"program": "${workspaceFolder}/src/isn/bin/Debug/netcoreapp2.1/isn.dll",
|
||||
"requireExactSource": false,
|
||||
"args": [
|
||||
"push", "/home/paul/Nupkgs/Yavsc.Abstract.1.0.8.nupkg"
|
||||
"push",
|
||||
"-s", "http://localhost:5000/index.json",
|
||||
"-k", "CfDJ8PZdCuMAkkdPqlnuLoghOuKBNLoprBqsy64fJqrYnVEOCj-eI7pfoVjHPXHazx_YSUDtnz9ic8olLY6JcZYOE2lVfpThjs8bE73AR4HjDQPhiMOY2NU-lWtCuxhk0K16xqOoFU5pAPLF83-YXJtt02_WMAQWfxVbq5_LpskRcZrk",
|
||||
"-p",
|
||||
"/home/paul/Nupkgs/Yavsc.Abstract.1.0.8.nupkg"
|
||||
],
|
||||
"cwd": "${workspaceFolder}/src/isn",
|
||||
"stopAtEntry": false,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<PackageVersion>1.0.1</PackageVersion>
|
||||
<Version>1.0.5</Version>
|
||||
<Version>1.0.7</Version>
|
||||
<TargetFrameworks>net451; net472; net4.8; netcoreapp2.1</TargetFrameworks>
|
||||
<NoWarn>NETSDK1138</NoWarn>
|
||||
<AssemblyVersion>1.0.5.0</AssemblyVersion>
|
||||
<FileVersion>1.0.5.0</FileVersion>
|
||||
<InformationalVersion>1.0.5+Branch.main.Sha.14206ac477d0f07566d5e8125dc52cbd7f474ca2</InformationalVersion>
|
||||
<AssemblyVersion>1.0.7.0</AssemblyVersion>
|
||||
<FileVersion>1.0.7.0</FileVersion>
|
||||
<InformationalVersion>1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327</InformationalVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ namespace isn
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
public string Protect(string data)
|
||||
{
|
||||
List<Byte> protd = new List<byte>();
|
||||
|
|
@ -31,7 +32,7 @@ namespace isn
|
|||
|
||||
public string UnProtect(string data)
|
||||
{
|
||||
|
||||
if (data==null) return null;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
List<byte> unps = new List<byte>();
|
||||
|
||||
|
|
|
|||
|
|
@ -42,9 +42,11 @@ namespace isn
|
|||
{ "v|version", "show soft version info and exit", h => shouldShowVersion = h != null }
|
||||
};
|
||||
|
||||
static string apiKey;
|
||||
|
||||
static readonly OptionSet pushoptions = new OptionSet {
|
||||
{ "k|api-key=", "use api key", val => apiKey = apiKey ?? val },
|
||||
{ "p|store-api-key", "store used api key (=<true|false>)", val => storApiKey = val != null },
|
||||
{ "p|store-api-key", "store used api key", val => storApiKey = val != null },
|
||||
{ "s|source=", "use source", val => CurrentSource = CurrentSource ?? val },
|
||||
{ "h|help", "show this message and exit", h => shouldShowPushHelp = h != null },
|
||||
};
|
||||
|
|
@ -60,10 +62,8 @@ namespace isn
|
|||
private static bool shouldShowVersion;
|
||||
private static bool shouldShowSourceHelp;
|
||||
private static bool shouldShowPushHelp;
|
||||
private static string apiKey = null;
|
||||
private static string currentSource = null;
|
||||
private static bool storApiKey = false;
|
||||
public static IDataProtector Protector { get; set; } = new DefaultDataProtector();
|
||||
|
||||
static Settings settings = null;
|
||||
|
||||
|
|
@ -74,11 +74,13 @@ namespace isn
|
|||
if (settings == null)
|
||||
LoadConfig();
|
||||
if (settings == null)
|
||||
{
|
||||
settings = new Settings
|
||||
{
|
||||
DataProtectionTitle = "isn",
|
||||
Sources = new Dictionary<string, SourceSettings>()
|
||||
};
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
|
|
@ -174,7 +176,6 @@ namespace isn
|
|||
return;
|
||||
}
|
||||
List<PushReport> reports = PushPkg(pargs);
|
||||
Console.WriteLine(JsonConvert.SerializeObject(reports));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,20 @@ namespace isn
|
|||
{
|
||||
public string ApiKey { get; set; }
|
||||
public string Alias { get; set; }
|
||||
|
||||
public string GetClearApiKey()
|
||||
{
|
||||
return Protector.UnProtect(ApiKey);
|
||||
}
|
||||
public void SetApiKey(string key)
|
||||
{
|
||||
ApiKey = Protector.Protect(key);
|
||||
}
|
||||
|
||||
public static IDataProtector Protector { get; set; } = new DefaultDataProtector();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class Settings
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace isn
|
|||
{
|
||||
public static class PushCommand
|
||||
{
|
||||
static public PushReport Run(string pkg, string source)
|
||||
static public PushReport Run(string pkg, string source, string apikey)
|
||||
{
|
||||
if (source == null) source = Program.Settings.DefaultSourceKey;
|
||||
if (source == null) throw new InvalidOperationException("source is null");
|
||||
|
|
@ -18,7 +18,6 @@ namespace isn
|
|||
source = Program.Settings.Sources.First(s=>s.Value.Alias==source).Key;
|
||||
if (source==null) throw new InvalidOperationException("source is invalid");
|
||||
|
||||
string apikey = Program.Protector.UnProtect(Program.Settings.Sources[source].ApiKey);
|
||||
var resources = SourceHelpers.GetServerResources(source);
|
||||
if (resources.Resources == null)
|
||||
throw new InvalidOperationException("source gave no resource");
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ namespace isn
|
|||
|
||||
foreach (string pkg in pkgs)
|
||||
{
|
||||
var report = PushCommand.Run(pkg, CurrentSource);
|
||||
|
||||
var report = PushCommand.Run(pkg, CurrentSource, apiKey);
|
||||
Console.WriteLine(report.ToDoc());
|
||||
pushReports.Add(report);
|
||||
}
|
||||
if (storApiKey)
|
||||
|
|
|
|||
|
|
@ -46,16 +46,16 @@ namespace isn
|
|||
else
|
||||
{
|
||||
// Une mise À jour
|
||||
string ptd = Protector.Protect(apiKey);
|
||||
Settings.Sources[CurrentSource].ApiKey = ptd;
|
||||
Settings.Sources[CurrentSource].SetApiKey(apiKey);
|
||||
if (Settings.DefaultSourceKey == null) Settings.DefaultSourceKey = CurrentSource;
|
||||
}
|
||||
}
|
||||
else if (apiKey != null)
|
||||
{
|
||||
// une addition
|
||||
string ptd = Protector.Protect(apiKey);
|
||||
Settings.Sources.Add(CurrentSource, new SourceSettings { ApiKey = ptd });
|
||||
var setting = new SourceSettings ();
|
||||
setting.SetApiKey(apiKey);
|
||||
Settings.Sources.Add(CurrentSource, setting);
|
||||
}
|
||||
SaveConfig();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,15 +4,15 @@
|
|||
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
|
||||
<RootNamespace>nuget_cli</RootNamespace>
|
||||
<UserSecretsId>45b74c62-05bc-4603-95b4-3e80ae2fdf50</UserSecretsId>
|
||||
<Version>1.0.5</Version>
|
||||
<Version>1.0.7</Version>
|
||||
<PackageVersion>1.0.1</PackageVersion>
|
||||
<IsPackable>true</IsPackable>
|
||||
<PackageLicenseExpression>WTFPL</PackageLicenseExpression>
|
||||
<IsTool>true</IsTool>
|
||||
<NoWarn>NETSDK1138</NoWarn>
|
||||
<AssemblyVersion>1.0.5.0</AssemblyVersion>
|
||||
<FileVersion>1.0.5.0</FileVersion>
|
||||
<InformationalVersion>1.0.5+Branch.main.Sha.14206ac477d0f07566d5e8125dc52cbd7f474ca2</InformationalVersion>
|
||||
<AssemblyVersion>1.0.7.0</AssemblyVersion>
|
||||
<FileVersion>1.0.7.0</FileVersion>
|
||||
<InformationalVersion>1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327</InformationalVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Mono.Options" Version="5.3.0" />
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Net;
|
||||
using System.Text;
|
||||
|
||||
namespace isn
|
||||
{
|
||||
|
|
@ -11,5 +12,19 @@ namespace isn
|
|||
public string Message { get; internal set; }
|
||||
public string StatusCode { get; internal set; }
|
||||
public string StackTrace { get; internal set; }
|
||||
|
||||
public string ToDoc()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder($"= Pushing {PkgName}\n\n");
|
||||
if (Executed) sb.AppendLine("* Executed");
|
||||
if (OK) sb.AppendLine("* OK");
|
||||
if (!string.IsNullOrWhiteSpace(Message))
|
||||
sb.AppendLine(Message);
|
||||
if (!string.IsNullOrWhiteSpace(StatusCode))
|
||||
sb.AppendLine($"* Status Code : ");
|
||||
if (!string.IsNullOrWhiteSpace(StackTrace))
|
||||
sb.AppendLine($"* StackTrace : ");
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -43,6 +43,7 @@ namespace isnd.Controllers
|
|||
|
||||
return View("Details", new PackageDetailViewModel
|
||||
{
|
||||
ExternalUrl = isndSettings.ExternalUrl,
|
||||
latest = latest,
|
||||
pkgid = pkgid,
|
||||
totalHits = packageVersion.Count(),
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ namespace isnd
|
|||
app.UseMigrationsEndPoint();
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ namespace isnd.ViewModels
|
|||
public int totalHits { get; set; }
|
||||
public PackageVersion[] data { get; set; }
|
||||
|
||||
public string ExternalUrl { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -25,8 +25,8 @@
|
|||
@Html.DisplayNameFor(model => model.latest.FullString)
|
||||
</dt>
|
||||
<dd>
|
||||
<a href="@Model.latest.NugetLink" >@Html.DisplayFor(model => model.latest.FullString)</a>
|
||||
<a href="@Model.latest.NuspecLink" >nuspec</a>
|
||||
<a href="@Model.ExternalUrl/@Model.latest.NugetLink" >@Html.DisplayFor(model => model.latest.FullString)</a>
|
||||
<a href="@Model.ExternalUrl/@Model.latest.NuspecLink" >nuspec</a>
|
||||
<i class="extinfo">(version count : @Model.totalHits)</i>
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
<IsPackable>true</IsPackable>
|
||||
<PackageLicenseExpression>WTFPL</PackageLicenseExpression>
|
||||
<NoWarn>NETSDK1138,CS1591,MSB3243</NoWarn>
|
||||
<AssemblyVersion>1.0.5.0</AssemblyVersion>
|
||||
<FileVersion>1.0.5.0</FileVersion>
|
||||
<InformationalVersion>1.0.5+Branch.main.Sha.14206ac477d0f07566d5e8125dc52cbd7f474ca2</InformationalVersion>
|
||||
<Version>1.0.5</Version>
|
||||
<AssemblyVersion>1.0.7.0</AssemblyVersion>
|
||||
<FileVersion>1.0.7.0</FileVersion>
|
||||
<InformationalVersion>1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327</InformationalVersion>
|
||||
<Version>1.0.7</Version>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
<RootNamespace>test_isn</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AssemblyVersion>1.0.5.0</AssemblyVersion>
|
||||
<FileVersion>1.0.5.0</FileVersion>
|
||||
<InformationalVersion>1.0.5+Branch.main.Sha.14206ac477d0f07566d5e8125dc52cbd7f474ca2</InformationalVersion>
|
||||
<Version>1.0.5</Version>
|
||||
<AssemblyVersion>1.0.7.0</AssemblyVersion>
|
||||
<FileVersion>1.0.7.0</FileVersion>
|
||||
<InformationalVersion>1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327</InformationalVersion>
|
||||
<Version>1.0.7</Version>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -3,10 +3,10 @@
|
|||
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
|
||||
<IsPackable>false</IsPackable>
|
||||
<NoWarn>NETSDK1138</NoWarn>
|
||||
<AssemblyVersion>1.0.5.0</AssemblyVersion>
|
||||
<FileVersion>1.0.5.0</FileVersion>
|
||||
<InformationalVersion>1.0.5+Branch.main.Sha.14206ac477d0f07566d5e8125dc52cbd7f474ca2</InformationalVersion>
|
||||
<Version>1.0.5</Version>
|
||||
<AssemblyVersion>1.0.7.0</AssemblyVersion>
|
||||
<FileVersion>1.0.7.0</FileVersion>
|
||||
<InformationalVersion>1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327</InformationalVersion>
|
||||
<Version>1.0.7</Version>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
|
||||
|
|
|
|||
|
|
@ -45,9 +45,12 @@ namespace isnd.host.tests
|
|||
|
||||
var isnSettings = services.GetRequiredService<IOptions<isn.Settings>>().Value;
|
||||
var dbContext = services.GetRequiredService<ApplicationDbContext>();
|
||||
var paul = dbContext.Users.FirstOrDefaultAsync(u => u.UserName == "paul").Result;
|
||||
var paul = dbContext.Users.FirstOrDefaultAsync(u => u.Email == "paul@pschneider.fr").Result;
|
||||
if (paul!=null)
|
||||
{
|
||||
dbContext.Users.Remove(paul);
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
|
||||
<IsPackable>false</IsPackable>
|
||||
<UserSecretsId>d7144e46-4e63-4391-ba86-64b61f6e7be4</UserSecretsId>
|
||||
<NoWarn>NETSDK1138</NoWarn>
|
||||
<AssemblyVersion>1.0.5.0</AssemblyVersion>
|
||||
<FileVersion>1.0.5.0</FileVersion>
|
||||
<InformationalVersion>1.0.5+Branch.main.Sha.14206ac477d0f07566d5e8125dc52cbd7f474ca2</InformationalVersion>
|
||||
<Version>1.0.5</Version>
|
||||
<AssemblyVersion>1.0.7.0</AssemblyVersion>
|
||||
<FileVersion>1.0.7.0</FileVersion>
|
||||
<InformationalVersion>1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327</InformationalVersion>
|
||||
<Version>1.0.7</Version>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="XunitXml.TestLogger" Version="3.0.70" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue