Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a3f133e
Add project
boma96 Jun 25, 2022
e94c8ea
Fix class namespaces and using statements
boma96 Jun 25, 2022
e2cc304
Remove yml generator
boma96 Jun 25, 2022
cccf8cc
Remove unnecessary registrations
boma96 Jun 25, 2022
1622bcc
Add template files
boma96 Jun 25, 2022
9c0e718
Fix namespaces and usings
boma96 Jun 25, 2022
e95b732
Fix namespaces and usings
boma96 Jun 25, 2022
69cf800
Fix namespaces
boma96 Jun 25, 2022
cc245d4
Fix namespaces and usings
boma96 Jun 25, 2022
b7014b3
Fix usings
boma96 Jun 25, 2022
a189b88
Fix usings
boma96 Jun 25, 2022
7a57c48
Fix namespaces and usings
boma96 Jun 25, 2022
cdb52fe
Fix namespaces and usings
boma96 Jun 25, 2022
1c148f5
Commit project file
boma96 Jun 25, 2022
cbc3fae
Rename class
boma96 Jun 25, 2022
ca92efb
Rename class
boma96 Jun 25, 2022
dad1c14
Rename class
boma96 Jun 25, 2022
109d80c
Remove properties not related to scaffolding
boma96 Jun 25, 2022
2821b15
Fix namespaces in template files
boma96 Jun 25, 2022
5846887
Fix namespaces
boma96 Jun 25, 2022
c7a9ebf
Retrieve host value
boma96 Jun 25, 2022
7b804a5
Remove code which assumed that wf name starts with capital letters(e.…
boma96 Jun 25, 2022
466f780
Pack project as tool
boma96 Jun 25, 2022
bb05c24
Merge branch 'master' into feat/master/toolkit
ognjenkatic Jul 1, 2022
8fbf95c
Align private field names to follow default conventions
boma96 Jul 8, 2022
fde3f66
Rename variable
boma96 Jul 8, 2022
01918c8
Merge branch 'feat/master/toolkit' of https://github.com/codaxy/condu…
boma96 Jul 8, 2022
d9db97b
Remove unnecessary comment
boma96 Jul 8, 2022
ddb3901
Remove async Task specifiers from method
boma96 Jul 8, 2022
f7582c9
Remove unnecessary comment
boma96 Jul 8, 2022
b52c7d2
Remove async Task
boma96 Jul 8, 2022
e00bd82
Do not await unawaitable methods
boma96 Jul 8, 2022
f450e7a
Add warning message when workflow description parsing fails
boma96 Jul 11, 2022
204a960
Add AppendClassProperty method
boma96 Jul 11, 2022
38df574
Extract functionality which adds generates class property to separate…
boma96 Jul 11, 2022
b442554
Remove unnecessary assignment
boma96 Jul 11, 2022
18f898b
Extract append xml comment functionality into separate method
boma96 Jul 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 79 additions & 73 deletions ConductorSharp.sln
Original file line number Diff line number Diff line change
@@ -1,73 +1,79 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31919.166
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConductorSharp.Engine", "src\ConductorSharp.Engine\ConductorSharp.Engine.csproj", "{22BDC06E-50E5-4FE4-97D2-CD9E07EF4842}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConductorSharp.Client", "src\ConductorSharp.Client\ConductorSharp.Client.csproj", "{3244BEE8-17C4-4B00-BEB1-A41CC3E95482}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConductorSharp.ApiEnabled", "examples\ConductorSharp.ApiEnabled\ConductorSharp.ApiEnabled.csproj", "{C350E5E2-EA36-4816-BCBB-CBB597AAFF78}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConductorSharp.Definitions", "examples\ConductorSharp.Definitions\ConductorSharp.Definitions.csproj", "{68400F84-CE5A-4FFA-A417-05C798ECD5A4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{16F68738-1ED3-4646-BE01-DB9246C10E89}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConductorSharp.NoApi", "examples\ConductorSharp.NoApi\ConductorSharp.NoApi.csproj", "{44E887F8-5E0D-4729-A4A8-AFEBBF87C6F9}"
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{C398B7D9-C238-4169-86A8-B03D01FBB2BE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConductorSharp.Engine.Tests", "test\ConductorSharp.Engine.Tests\ConductorSharp.Engine.Tests.csproj", "{45AB7886-41DB-4A0E-9667-1C78D63F0FC7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DE1FA421-B8D6-45A7-9667-0798A241A89C}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{22BDC06E-50E5-4FE4-97D2-CD9E07EF4842}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{22BDC06E-50E5-4FE4-97D2-CD9E07EF4842}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22BDC06E-50E5-4FE4-97D2-CD9E07EF4842}.Release|Any CPU.ActiveCfg = Release|Any CPU
{22BDC06E-50E5-4FE4-97D2-CD9E07EF4842}.Release|Any CPU.Build.0 = Release|Any CPU
{3244BEE8-17C4-4B00-BEB1-A41CC3E95482}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3244BEE8-17C4-4B00-BEB1-A41CC3E95482}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3244BEE8-17C4-4B00-BEB1-A41CC3E95482}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3244BEE8-17C4-4B00-BEB1-A41CC3E95482}.Release|Any CPU.Build.0 = Release|Any CPU
{C350E5E2-EA36-4816-BCBB-CBB597AAFF78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C350E5E2-EA36-4816-BCBB-CBB597AAFF78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C350E5E2-EA36-4816-BCBB-CBB597AAFF78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C350E5E2-EA36-4816-BCBB-CBB597AAFF78}.Release|Any CPU.Build.0 = Release|Any CPU
{68400F84-CE5A-4FFA-A417-05C798ECD5A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68400F84-CE5A-4FFA-A417-05C798ECD5A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68400F84-CE5A-4FFA-A417-05C798ECD5A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68400F84-CE5A-4FFA-A417-05C798ECD5A4}.Release|Any CPU.Build.0 = Release|Any CPU
{44E887F8-5E0D-4729-A4A8-AFEBBF87C6F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{44E887F8-5E0D-4729-A4A8-AFEBBF87C6F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{44E887F8-5E0D-4729-A4A8-AFEBBF87C6F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{44E887F8-5E0D-4729-A4A8-AFEBBF87C6F9}.Release|Any CPU.Build.0 = Release|Any CPU
{C398B7D9-C238-4169-86A8-B03D01FBB2BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C398B7D9-C238-4169-86A8-B03D01FBB2BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C398B7D9-C238-4169-86A8-B03D01FBB2BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C398B7D9-C238-4169-86A8-B03D01FBB2BE}.Release|Any CPU.Build.0 = Release|Any CPU
{45AB7886-41DB-4A0E-9667-1C78D63F0FC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{45AB7886-41DB-4A0E-9667-1C78D63F0FC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45AB7886-41DB-4A0E-9667-1C78D63F0FC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45AB7886-41DB-4A0E-9667-1C78D63F0FC7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C350E5E2-EA36-4816-BCBB-CBB597AAFF78} = {16F68738-1ED3-4646-BE01-DB9246C10E89}
{68400F84-CE5A-4FFA-A417-05C798ECD5A4} = {16F68738-1ED3-4646-BE01-DB9246C10E89}
{44E887F8-5E0D-4729-A4A8-AFEBBF87C6F9} = {16F68738-1ED3-4646-BE01-DB9246C10E89}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2443B3EC-E590-4C83-8BE2-A0787C66307C}
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31919.166
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConductorSharp.Engine", "src\ConductorSharp.Engine\ConductorSharp.Engine.csproj", "{22BDC06E-50E5-4FE4-97D2-CD9E07EF4842}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConductorSharp.Client", "src\ConductorSharp.Client\ConductorSharp.Client.csproj", "{3244BEE8-17C4-4B00-BEB1-A41CC3E95482}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConductorSharp.ApiEnabled", "examples\ConductorSharp.ApiEnabled\ConductorSharp.ApiEnabled.csproj", "{C350E5E2-EA36-4816-BCBB-CBB597AAFF78}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConductorSharp.Definitions", "examples\ConductorSharp.Definitions\ConductorSharp.Definitions.csproj", "{68400F84-CE5A-4FFA-A417-05C798ECD5A4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{16F68738-1ED3-4646-BE01-DB9246C10E89}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConductorSharp.NoApi", "examples\ConductorSharp.NoApi\ConductorSharp.NoApi.csproj", "{44E887F8-5E0D-4729-A4A8-AFEBBF87C6F9}"
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{C398B7D9-C238-4169-86A8-B03D01FBB2BE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConductorSharp.Engine.Tests", "test\ConductorSharp.Engine.Tests\ConductorSharp.Engine.Tests.csproj", "{45AB7886-41DB-4A0E-9667-1C78D63F0FC7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConductorSharp.Toolkit", "src\ConductorSharp.Toolkit\ConductorSharp.Toolkit.csproj", "{7FC97985-07CE-4643-8415-C48BA2117D88}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DE1FA421-B8D6-45A7-9667-0798A241A89C}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{22BDC06E-50E5-4FE4-97D2-CD9E07EF4842}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{22BDC06E-50E5-4FE4-97D2-CD9E07EF4842}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22BDC06E-50E5-4FE4-97D2-CD9E07EF4842}.Release|Any CPU.ActiveCfg = Release|Any CPU
{22BDC06E-50E5-4FE4-97D2-CD9E07EF4842}.Release|Any CPU.Build.0 = Release|Any CPU
{3244BEE8-17C4-4B00-BEB1-A41CC3E95482}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3244BEE8-17C4-4B00-BEB1-A41CC3E95482}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3244BEE8-17C4-4B00-BEB1-A41CC3E95482}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3244BEE8-17C4-4B00-BEB1-A41CC3E95482}.Release|Any CPU.Build.0 = Release|Any CPU
{C350E5E2-EA36-4816-BCBB-CBB597AAFF78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C350E5E2-EA36-4816-BCBB-CBB597AAFF78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C350E5E2-EA36-4816-BCBB-CBB597AAFF78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C350E5E2-EA36-4816-BCBB-CBB597AAFF78}.Release|Any CPU.Build.0 = Release|Any CPU
{68400F84-CE5A-4FFA-A417-05C798ECD5A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68400F84-CE5A-4FFA-A417-05C798ECD5A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68400F84-CE5A-4FFA-A417-05C798ECD5A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68400F84-CE5A-4FFA-A417-05C798ECD5A4}.Release|Any CPU.Build.0 = Release|Any CPU
{44E887F8-5E0D-4729-A4A8-AFEBBF87C6F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{44E887F8-5E0D-4729-A4A8-AFEBBF87C6F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{44E887F8-5E0D-4729-A4A8-AFEBBF87C6F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{44E887F8-5E0D-4729-A4A8-AFEBBF87C6F9}.Release|Any CPU.Build.0 = Release|Any CPU
{C398B7D9-C238-4169-86A8-B03D01FBB2BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C398B7D9-C238-4169-86A8-B03D01FBB2BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C398B7D9-C238-4169-86A8-B03D01FBB2BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C398B7D9-C238-4169-86A8-B03D01FBB2BE}.Release|Any CPU.Build.0 = Release|Any CPU
{45AB7886-41DB-4A0E-9667-1C78D63F0FC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{45AB7886-41DB-4A0E-9667-1C78D63F0FC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45AB7886-41DB-4A0E-9667-1C78D63F0FC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45AB7886-41DB-4A0E-9667-1C78D63F0FC7}.Release|Any CPU.Build.0 = Release|Any CPU
{7FC97985-07CE-4643-8415-C48BA2117D88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7FC97985-07CE-4643-8415-C48BA2117D88}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7FC97985-07CE-4643-8415-C48BA2117D88}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7FC97985-07CE-4643-8415-C48BA2117D88}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C350E5E2-EA36-4816-BCBB-CBB597AAFF78} = {16F68738-1ED3-4646-BE01-DB9246C10E89}
{68400F84-CE5A-4FFA-A417-05C798ECD5A4} = {16F68738-1ED3-4646-BE01-DB9246C10E89}
{44E887F8-5E0D-4729-A4A8-AFEBBF87C6F9} = {16F68738-1ED3-4646-BE01-DB9246C10E89}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2443B3EC-E590-4C83-8BE2-A0787C66307C}
EndGlobalSection
EndGlobal
10 changes: 10 additions & 0 deletions src/ConductorSharp.Toolkit/Commands/Command.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using ConductorSharp.Toolkit.Models;

namespace ConductorSharp.Toolkit.Commands
{
public interface Command
{
public string GetName();
public Task Execute(CommandInput input);
}
}
14 changes: 14 additions & 0 deletions src/ConductorSharp.Toolkit/Commands/CommandRegistry.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace ConductorSharp.Toolkit.Commands
{
public class CommandRegistry
{
private readonly IEnumerable<Command> _commands;

public CommandRegistry(IEnumerable<Command> commands)
{
_commands = commands;
}

public Command Get(string name) => _commands.FirstOrDefault(a => a.GetName() == name);
}
}
20 changes: 20 additions & 0 deletions src/ConductorSharp.Toolkit/Commands/ScaffoldCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using ConductorSharp.Toolkit.Models;
using ConductorSharp.Toolkit.Service;

namespace ConductorSharp.Toolkit.Commands
{
public class ScaffoldCommand : Command
{
private readonly IScaffoldingService _scaffoldingService;
public ScaffoldCommand(IScaffoldingService scaffoldingService)
{
_scaffoldingService = scaffoldingService;
}

public string GetName() => "scaffold";
public async Task Execute(CommandInput input)
{
await _scaffoldingService.Scaffold();
}
}
}
36 changes: 36 additions & 0 deletions src/ConductorSharp.Toolkit/ConductorSharp.Toolkit.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<PackAsTool>true</PackAsTool>
<ToolCommandName>dotnet-conductorsharp</ToolCommandName>
</PropertyGroup>

<ItemGroup>
<None Remove="Templates\TaskCollectionTemplate.default" />
<None Remove="Templates\WorkerTemplate.default" />
<None Remove="Templates\WorkflowCollectionTemplate.default" />
<None Remove="Templates\WorkflowTemplate.default" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Templates\TaskCollectionTemplate.default" />
<EmbeddedResource Include="Templates\WorkerTemplate.default" />
<EmbeddedResource Include="Templates\WorkflowCollectionTemplate.default" />
<EmbeddedResource Include="Templates\WorkflowTemplate.default" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ConductorSharp.Engine\ConductorSharp.Engine.csproj" />
</ItemGroup>

</Project>
11 changes: 11 additions & 0 deletions src/ConductorSharp.Toolkit/Models/CommandInput.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace ConductorSharp.Toolkit.Models
{
public class CommandInput
{
public string Api { get; set; }
public string Namespace { get; set; }
public string Host { get; set; }
public bool Dryrun { get; set; }
public string Destination { get; set; }
}
}
25 changes: 25 additions & 0 deletions src/ConductorSharp.Toolkit/Models/WorkerDocument.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Collections;

namespace ConductorSharp.Toolkit.Models
{
public class WorkerDocument
{
public WorkerDocument()
{
InputTable = new List<string>();
OutputTable = new List<string>();
UpdatedWorkers = new Hashtable();
}

public string SourcePath { get; set; }
public string DestinationPath { get; set; }
public string WorkerName { get; set; }
public string WorkerDescription { get; set; } //short description of worker
public List<string> InputTable { get; set; }
public List<string> OutputTable { get; set; }
public Hashtable UpdatedWorkers { get; set; } //to prevent us from adding the same task twice or more, because it can happen that several workflows use the same worker
public string OwnerApp { get; set; }
public string OwnerEmail { get; set; }
public string RegistrationTime { get; set; }
}
}
19 changes: 19 additions & 0 deletions src/ConductorSharp.Toolkit/Models/WorkflowDocument.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace ConductorSharp.Toolkit.Models
{
public class WorkflowDocument
{
public string SourcePath { get; set; } //path to .md file of the workflow
public string DestinationPath { get; set; }
public string WorkflowName { get; set; }
public string WorkflowDescription { get; set; } //short description of workflow
public List<string> DiagramCode { get; set; }
public List<string> InputTable { get; set; }
public List<string> TaskTable { get; set; }
public List<string> OutputTable { get; set; }
public string OwnerApp { get; set; }
public string OwnerEmail { get; set; }
public string Version { get; set; }
public string FailureWorkflow { get; set; }
public string RegistrationTime { get; set; }
}
}
77 changes: 77 additions & 0 deletions src/ConductorSharp.Toolkit/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
using Autofac;
using Autofac.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using ConductorSharp.Engine.Extensions;
using ConductorSharp.Toolkit.Commands;
using ConductorSharp.Toolkit.Models;

namespace ConductorSharp.Toolkit
{
class Program
{
public async static Task Main(string[] args)
{
try
{
var action = args[0];

var input = ParseInput(args);

var container = BuildContainer(input);

var commandRegistry = container.Resolve<CommandRegistry>();

var command = commandRegistry.Get(action);

await command.Execute(input);
}
catch (Exception exc)
{
PrintHelp();
}
}

private static void PrintHelp() => Console.WriteLine("PLACEHOLDER HELP");

private static IContainer BuildContainer(CommandInput input)
{
var serviceCollection = new ServiceCollection();

serviceCollection.AddLogging();

var builder = new ContainerBuilder();

serviceCollection.Configure<ScaffoldingConfig>(
config =>
{
config.ApiUrl = input.Api;
config.BaseUrl = input.Host;
config.BaseNamespace = input.Namespace;
config.Dryrun = input.Dryrun;
config.Destination = input.Destination;
}
);

builder.Populate(serviceCollection);
builder.AddWorkflowEngine(input.Host, input.Api);
builder.RegisterModule(new ToolkitModule());

return builder.Build();
}

private static CommandInput ParseInput(string[] args)
{
var action = args[0];
var inputParameters = args.Skip(1).Select(a => new KeyValuePair<string, string>(a.Split("=")[0], a.Split("=")[1])).ToList();

return new CommandInput
{
Api = inputParameters.Where(a => a.Key == "path").Select(a => a.Value).FirstOrDefault(),
Namespace = inputParameters.Where(a => a.Key == "namespace").Select(a => a.Value).FirstOrDefault(),
Host = inputParameters.Where(a => a.Key == "host").Select(a => a.Value).FirstOrDefault(),
Dryrun = inputParameters.Where(a => a.Key == "dryrun").Select(a => bool.Parse(a.Value)).FirstOrDefault(),
Destination = inputParameters.Where(a => a.Key == "destination").Select(a => a.Value).FirstOrDefault()
};
}
}
}
11 changes: 11 additions & 0 deletions src/ConductorSharp.Toolkit/ScaffoldingConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace ConductorSharp.Toolkit
{
public class ScaffoldingConfig
{
public string BaseNamespace { get; set; }
public string ApiUrl { get; set; }
public string BaseUrl { get; set; }
public bool Dryrun { get; set; }
public string Destination { get; set; }
}
}
7 changes: 7 additions & 0 deletions src/ConductorSharp.Toolkit/Service/IScaffoldingService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace ConductorSharp.Toolkit.Service
{
public interface IScaffoldingService
{
Task Scaffold();
}
}
Loading