Kysect.ScenarioLib 0.1.8

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Kysect.ScenarioLib --version 0.1.8                
NuGet\Install-Package Kysect.ScenarioLib -Version 0.1.8                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kysect.ScenarioLib" Version="0.1.8" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Kysect.ScenarioLib --version 0.1.8                
#r "nuget: Kysect.ScenarioLib, 0.1.8"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Kysect.ScenarioLib as a Cake Addin
#addin nuget:?package=Kysect.ScenarioLib&version=0.1.8

// Install Kysect.ScenarioLib as a Cake Tool
#tool nuget:?package=Kysect.ScenarioLib&version=0.1.8                

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.9 109 5/19/2024
0.1.8 102 5/11/2024
0.1.7 224 3/17/2024
0.1.6 159 3/3/2024
0.1.5 196 2/10/2024
0.1.4 269 12/24/2023
0.1.3 217 12/2/2023
0.1.2 134 12/1/2023
0.1.1 135 11/29/2023
0.1.0 149 11/19/2023