generated from SwissLife-OSS/template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add version info and improve start ui command
- Loading branch information
Philippe
committed
May 6, 2021
1 parent
fae5c3e
commit 5b82848
Showing
41 changed files
with
554 additions
and
253 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/Tool/src/Boost.Abstractions/Infrastructure/BoostVersionInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Boost.Nuget; | ||
|
||
namespace Boost.Infrastructure | ||
{ | ||
public class BoostVersionInfo | ||
{ | ||
public string PackageId { get; set; } | ||
|
||
public string? Installed { get; set; } | ||
|
||
public NugetPackageVersionInfo? Latest { get; set; } | ||
|
||
public NugetPackageVersionInfo? PreRelease { get; set; } | ||
public bool NewerAvailable { get; set; } | ||
public bool NewerPreReleaseAvailable { get; set; } | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Tool/src/Boost.Abstractions/Infrastructure/DataProtectorKeyRing.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Boost.Infrastructure | ||
{ | ||
public class DataProtectorKeyRing | ||
{ | ||
public Guid? ActiveKeyId { get; set; } | ||
|
||
public IList<EncryptionKeySetting> Protectors { get; set; } = new List<EncryptionKeySetting>(); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/Tool/src/Boost.Abstractions/Infrastructure/EncryptionKeySetting.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Boost.Infrastructure | ||
{ | ||
public class EncryptionKeySetting | ||
{ | ||
public Guid Id { get; set; } | ||
|
||
public string Name { get; set; } | ||
|
||
public Dictionary<string, string> Parameters { get; set; } | ||
= new Dictionary<string, string>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/Tool/src/Boost.Abstractions/Infrastructure/IVersionChecker.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace Boost.Infrastructure | ||
{ | ||
public interface IVersionChecker | ||
{ | ||
Task<BoostVersionInfo> GetVersionInfo(CancellationToken cancellationToken); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Boost.Nuget | ||
{ | ||
public record NugetPackageInfo(string PackageId) | ||
{ | ||
public NugetPackageVersionInfo? LatestStable { get; init; } | ||
public NugetPackageVersionInfo? LatestPreRelease { get; init; } | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/Tool/src/Boost.Abstractions/Nuget/NugetPackageVersionInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
using System; | ||
|
||
namespace Boost.Nuget | ||
{ | ||
public record NugetPackageVersionInfo(string Version, DateTimeOffset Published); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Boost.Nuget | ||
{ | ||
public record PackageVersion(string Name, string Version) | ||
{ | ||
public string? Reference { get; init; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Boost.Infrastructure; | ||
using McMaster.Extensions.CommandLineUtils; | ||
|
||
namespace Boost.Commands | ||
{ | ||
[Command( | ||
Name = "version", | ||
FullName = "Version", | ||
Description = "Get current Version and check for new version"), HelpOption] | ||
public class VersionCommand : CommandBase | ||
{ | ||
private readonly IVersionChecker _versionChecker; | ||
|
||
public VersionCommand(IVersionChecker versionChecker | ||
) | ||
{ | ||
_versionChecker = versionChecker; | ||
} | ||
|
||
public async Task OnExecute( | ||
CommandLineApplication app, | ||
IConsole console) | ||
{ | ||
BoostVersionInfo version = await _versionChecker.GetVersionInfo(CommandAborded); | ||
|
||
if (version is { }) | ||
{ | ||
Console.WriteLine("Boost Version info"); | ||
Console.WriteLine("------------------"); | ||
Console.WriteLine($"Installed:\t{version.Installed}"); | ||
|
||
if (version.Latest is { }) | ||
{ | ||
Console.WriteLine( | ||
$"Latest:\t\t{version.Latest.Version}" + | ||
$" ({version.Latest.Published:d})"); | ||
} | ||
|
||
if (version.PreRelease is { }) | ||
{ | ||
Console.WriteLine( | ||
$"Latest Pre-Release:\t{version.PreRelease.Version}" + | ||
$" ({version.PreRelease.Published:d})"); | ||
} | ||
|
||
console.WriteLine(); | ||
|
||
if (version.NewerAvailable) | ||
{ | ||
console.Write( | ||
$"Run `dotnet tool update -g {version.PackageId}` " + | ||
"to install latest stable version"); | ||
} | ||
|
||
|
||
if (version.NewerPreReleaseAvailable) | ||
{ | ||
console.Write( | ||
$"Run `dotnet tool update -g {version.PackageId} --version {version.PreRelease!.Version}` " + | ||
"to install latest pre release version"); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/Tool/src/Boost.Core/GraphQL/GraphQLServiceCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using Boost.GraphQL; | ||
using HotChocolate; | ||
using HotChocolate.Execution.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Boost.Core.GraphQL | ||
{ | ||
public static class GraphQLServiceCollectionExtensions | ||
{ | ||
public static IServiceCollection AddGraphQLServices( | ||
this IServiceCollection services, | ||
Action<IRequestExecutorBuilder>? configure = null) | ||
{ | ||
IRequestExecutorBuilder builder = services.AddGraphQLServer() | ||
.ModifyRequestOptions(m => m.IncludeExceptionDetails = true) | ||
.AddQueryType(d => d.Name(RootTypes.Query)) | ||
.AddMutationType(d => d.Name(RootTypes.Mutation)) | ||
.AddBoostTypes(); | ||
|
||
configure?.Invoke(builder); | ||
|
||
return services; | ||
} | ||
} | ||
} |
Oops, something went wrong.