Kysect.ScenarioLib.YamlParser
0.1.9
Prefix Reserved
dotnet add package Kysect.ScenarioLib.YamlParser --version 0.1.9
NuGet\Install-Package Kysect.ScenarioLib.YamlParser -Version 0.1.9
<PackageReference Include="Kysect.ScenarioLib.YamlParser" Version="0.1.9" />
paket add Kysect.ScenarioLib.YamlParser --version 0.1.9
#r "nuget: Kysect.ScenarioLib.YamlParser, 0.1.9"
// Install Kysect.ScenarioLib.YamlParser as a Cake Addin #addin nuget:?package=Kysect.ScenarioLib.YamlParser&version=0.1.9 // Install Kysect.ScenarioLib.YamlParser as a Cake Tool #tool nuget:?package=Kysect.ScenarioLib.YamlParser&version=0.1.9
Kysect.ScenarioLib
Kysect.ScenarioLib is a NuGet library for parsing of YAML files containing descriptions of specific steps and the execution of these steps. The primary purpose of this library is to streamline the process of defining and running scenarios within an application.
Key features of Kysect.ScenarioLib include:
YAML Parsing: The library includes robust YAML parsing capabilities, allowing developers to define scenarios in a human-readable format. This is particularly useful for creating structured and easily maintainable descriptions of various steps in a workflow.
Scenario Definition: With Kysect.ScenarioLib, users can define scenarios by specifying a sequence of steps in a YAML file. Each step is outlined in the YAML file, providing a clear and organized representation of the desired workflow.
Step Execution: The library executes the steps defined in the YAML file, automating the process and reducing the need for manual intervention. This feature is especially beneficial for automating repetitive tasks or complex workflows.
Customization: Kysect.ScenarioLib is designed to be flexible and customizable. Developers can extend the library to incorporate custom step types or behaviors, allowing for tailored solutions that meet specific project requirements.
How to use
How to define scenario steps
Scenario step arguments definition:
[ScenarioStep("Environment.BuildSolution")]
public record EnvironmentBuildSolution(string SolutionPath) : IScenarioStep;
- ScenarioStepAttribute and IScenarioStep implementation mark type for parsing as ScenarioStep
- ScenarioStepAttribute allow to define user-friendly name
- Type properties allow to define input arguments
Scenario step execution logic definition:
public class EnvironmentBuildSolutionExecutor : IScenarioStepExecutor<EnvironmentBuildSolution>
{
// fields that can be assigned via DI
public EnvironmentBuildSolutionExecutor(/* arguments */)
{
// field initialization
}
public void Execute(EnvironmentBuildSolution request)
{
_logger.LogDebug("Building solution {name}", request.SolutionPath);
_msbuild.BuildSolution(request.SolutionPath);
}
}
Scenario file definition:
- Name: Git.Pull
Parameters:
Path: C:\path\to\repository
- Name: Environment.BuildSolution
Parameters:
SolutionPath: $/Backup/Development/9.5-Updates
Depencency injection container configuration
Configuration sample for Microsoft.Extensions.DependencyInjection
:
public static IServiceCollection AddCloudextScenarioExecutionServices(this IServiceCollection serviceCollection)
{
const string pathToDirectoryWithScenarions = @"C:\scenarios";
Assembly[] assemblies = new[]
{
// Definition of assembly with IScenarioStep implemenration
// Definition of assembly with IScenarioStepExecutor implemenration
};
return serviceCollection
.AddSingleton<IScenarioSourceProvider>(sp => new ScenarioSourceProvider(pathToDirectoryWithScenarions))
.AddSingleton<IScenarioSourceCodeParser, YamlScenarioSourceCodeParser>()
.AddSingleton<IScenarioStepParser, ScenarioStepReflectionParser>(_ => ScenarioStepReflectionParser.Create(assemblies))
.AddAllImplementationOf<IScenarioStepExecutor>(assemblies)
.AddSingleton<IScenarioStepHandler, ScenarioStepReflectionHandler>(sp => ScenarioStepReflectionHandler.Create(sp, assemblies))
.AddSingleton<ScenarioExecutor>();
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Kysect.CommonLib (>= 0.1.22)
- Kysect.ScenarioLib.Abstractions (>= 0.1.9)
- YamlDotNet (>= 15.1.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.