Skip to content

Commit 751f2b5

Browse files
committed
Initial commit
0 parents  commit 751f2b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1945
-0
lines changed

.gitignore

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
4+
# User-specific files
5+
*.suo
6+
*.user
7+
*.userosscache
8+
*.sln.docstates
9+
10+
# Build results
11+
[Dd]ebug/
12+
[Dd]ebugPublic/
13+
[Rr]elease/
14+
[Rr]eleases/
15+
x64/
16+
x86/
17+
bld/
18+
[Bb]in/
19+
[Oo]bj/
20+
[Ll]og/
21+
nupkg/
22+
23+
# Visual Studio 2015 cache/options directory
24+
.vs/
25+
26+
# MSTest test Results
27+
[Tt]est[Rr]esult*/
28+
[Bb]uild[Ll]og.*
29+
30+
# NUNIT
31+
*.VisualState.xml
32+
TestResult.xml
33+
34+
# Build Results of an ATL Project
35+
[Dd]ebugPS/
36+
[Rr]eleasePS/
37+
dlldata.c
38+
39+
# DNX
40+
project.lock.json
41+
project.fragment.lock.json
42+
artifacts/
43+
44+
*_i.c
45+
*_p.c
46+
*_i.h
47+
*.ilk
48+
*.meta
49+
*.obj
50+
*.pch
51+
*.pdb
52+
*.pgc
53+
*.pgd
54+
*.rsp
55+
*.sbr
56+
*.tlb
57+
*.tli
58+
*.tlh
59+
*.tmp
60+
*.tmp_proj
61+
*.log
62+
*.vspscc
63+
*.vssscc
64+
.builds
65+
*.pidb
66+
*.svclog
67+
*.scc
68+
69+
# Visual Studio profiler
70+
*.psess
71+
*.vsp
72+
*.vspx
73+
*.sap
74+
75+
# ReSharper is a .NET coding add-in
76+
_ReSharper*/
77+
*.[Rr]e[Ss]harper
78+
*.DotSettings.user
79+
80+
# Installshield output folder
81+
[Ee]xpress/
82+
83+
# NuGet Packages
84+
*.nupkg
85+
86+
# The packages folder can be ignored because of Package Restore
87+
**/packages/*
88+
89+
# except build/, which is used as an MSBuild target.
90+
!**/packages/build/
91+
# Uncomment if necessary however generally it will be regenerated when needed
92+
#!**/packages/repositories.config
93+
# NuGet v3's project.json files produces more ignoreable files
94+
*.nuget.props
95+
*.nuget.targets
96+
97+
# Visual Studio cache files
98+
# files ending in .cache can be ignored
99+
*.[Cc]ache
100+
# but keep track of directories ending in .cache
101+
!*.[Cc]ache/
102+
103+
# Others
104+
ClientBin/
105+
~$*
106+
*~
107+
*.dbmdl
108+
*.dbproj.schemaview
109+
*.pfx
110+
*.publishsettings
111+
node_modules/
112+
orleans.codegen.cs

Moryx.Cli.sln

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.5.33530.505
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moryx.Cli", "src\Moryx.Cli\Moryx.Cli.csproj", "{13F36F0F-F879-4A52-99AE-ABF895F2D375}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moryx.Cli.Tests", "src\Moryx.Cli.Tests\Moryx.Cli.Tests.csproj", "{E65D2591-A889-4F42-A6F5-AECAFB77DBB0}"
9+
EndProject
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moryx.Cli.Commands", "src\Moryx.Cli.Commands\Moryx.Cli.Commands.csproj", "{A05301A2-A68F-40BE-8ED9-0A8DF0CECFCE}"
11+
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Moryx.Cli.Template", "src\Moryx.Cli.Template\Moryx.Cli.Template.csproj", "{FDE96997-1492-4FC1-AE66-E7F76A7B8374}"
13+
EndProject
14+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Moryx.Cli.Config", "src\Moryx.Cli.Config\Moryx.Cli.Config.csproj", "{F6E69A2A-F183-4A01-8629-CEBBB0417ED6}"
15+
EndProject
16+
Global
17+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
18+
Debug|Any CPU = Debug|Any CPU
19+
Release|Any CPU = Release|Any CPU
20+
EndGlobalSection
21+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
22+
{13F36F0F-F879-4A52-99AE-ABF895F2D375}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{13F36F0F-F879-4A52-99AE-ABF895F2D375}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{13F36F0F-F879-4A52-99AE-ABF895F2D375}.Release|Any CPU.ActiveCfg = Release|Any CPU
25+
{13F36F0F-F879-4A52-99AE-ABF895F2D375}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{E65D2591-A889-4F42-A6F5-AECAFB77DBB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{E65D2591-A889-4F42-A6F5-AECAFB77DBB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{E65D2591-A889-4F42-A6F5-AECAFB77DBB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{E65D2591-A889-4F42-A6F5-AECAFB77DBB0}.Release|Any CPU.Build.0 = Release|Any CPU
30+
{A05301A2-A68F-40BE-8ED9-0A8DF0CECFCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31+
{A05301A2-A68F-40BE-8ED9-0A8DF0CECFCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
32+
{A05301A2-A68F-40BE-8ED9-0A8DF0CECFCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
33+
{A05301A2-A68F-40BE-8ED9-0A8DF0CECFCE}.Release|Any CPU.Build.0 = Release|Any CPU
34+
{FDE96997-1492-4FC1-AE66-E7F76A7B8374}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35+
{FDE96997-1492-4FC1-AE66-E7F76A7B8374}.Debug|Any CPU.Build.0 = Debug|Any CPU
36+
{FDE96997-1492-4FC1-AE66-E7F76A7B8374}.Release|Any CPU.ActiveCfg = Release|Any CPU
37+
{FDE96997-1492-4FC1-AE66-E7F76A7B8374}.Release|Any CPU.Build.0 = Release|Any CPU
38+
{F6E69A2A-F183-4A01-8629-CEBBB0417ED6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39+
{F6E69A2A-F183-4A01-8629-CEBBB0417ED6}.Debug|Any CPU.Build.0 = Debug|Any CPU
40+
{F6E69A2A-F183-4A01-8629-CEBBB0417ED6}.Release|Any CPU.ActiveCfg = Release|Any CPU
41+
{F6E69A2A-F183-4A01-8629-CEBBB0417ED6}.Release|Any CPU.Build.0 = Release|Any CPU
42+
EndGlobalSection
43+
GlobalSection(SolutionProperties) = preSolution
44+
HideSolutionNode = FALSE
45+
EndGlobalSection
46+
GlobalSection(ExtensibilityGlobals) = postSolution
47+
SolutionGuid = {99BD1616-551D-473A-A6DB-6A9C0F030AB7}
48+
EndGlobalSection
49+
EndGlobal

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# MORYX.CLI
2+
3+
## `new`
4+
5+
Creates a new MORYX solution, optionally with some products and steps already.
6+
7+
### Usage
8+
9+
moryx new <NAME> [--products <PRODUCTS>] [--steps <STEPS>] [--no-git-init]
10+
11+
12+
## `add product`
13+
14+
Adds a product 'name'
15+
16+
### Usage
17+
18+
moryx add product <NAME>
19+
20+
21+
## `add step`
22+
23+
Adds a production step 'name', that is a cell with a task, aktivity, capabilites
24+
and so on.
25+
26+
### Usage
27+
28+
moryx add step <NAME> [--without-cell]
29+
30+
31+
## `exec`
32+
33+
Exec is meant to execute 'command' against a running MORYX instance.
34+
This is rather a workaround.
35+
36+
### Usage
37+
38+
moryx exec <COMMAND> [--endpoint]
39+
40+
### Examples
41+
42+
moryx exec create-dbs

src/Moryx.Cli.Commands/Add.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using Moryx.Cli.Template.Extensions;
2+
using Moryx.Cli.Commands.Options;
3+
using Moryx.Cli.Template.Models;
4+
using Moryx.Cli.Commands.Extensions;
5+
6+
namespace Moryx.Cli.Commands
7+
{
8+
public static class Add
9+
{
10+
public static CommandResult Step(AddOptions options)
11+
{
12+
return AddThing(options, (settings) => AddSteps.Exec(settings, options.Name!.ToCleanList()));
13+
}
14+
15+
public static CommandResult Products(AddOptions options)
16+
{
17+
return AddThing(options, (settings) => AddProducts.Exec(settings, options.Name!.ToCleanList()));
18+
}
19+
20+
public static CommandResult Module(AddOptions options)
21+
{
22+
return AddThing(options, (settings) => AddModule.Exec(settings, options.Name!));
23+
}
24+
25+
private static CommandResult AddThing(AddOptions options, Func<TemplateSettings, CommandResult> func)
26+
{
27+
var currentDir = Environment.CurrentDirectory;
28+
var solutionNameError = string.Empty;
29+
var solutionName = Template.Template.GetSolutionName(currentDir, error =>
30+
{
31+
Console.WriteLine(error);
32+
solutionNameError = error;
33+
});
34+
35+
if (string.IsNullOrEmpty(solutionName))
36+
return CommandResult.WithError(solutionNameError);
37+
38+
var dir = Path.GetFullPath(currentDir);
39+
40+
var settings = ConfigExtensions.LoadSettings(dir, solutionName);
41+
settings.Repository = options.Template ?? settings.Repository;
42+
settings.Branch = options.Branch ?? settings.Branch;
43+
settings.Pull = options.Pull;
44+
45+
return func(settings);
46+
}
47+
}
48+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using Moryx.Cli.Template;
2+
using Moryx.Cli.Template.Models;
3+
using System.Text.RegularExpressions;
4+
5+
namespace Moryx.Cli.Commands
6+
{
7+
public static class AddModule
8+
{
9+
public static CommandResult Exec(TemplateSettings settings, string moduleName)
10+
{
11+
return CommandBase.Exec(settings, (filenames) =>
12+
AddThing.Exec(
13+
settings,
14+
new AddConfig
15+
{
16+
SolutionName = settings.AppName,
17+
ThingName = moduleName,
18+
Thing = "module",
19+
ThingPlaceholder = Template.Template.ModulePlaceholder,
20+
},
21+
filenames.Module(),
22+
s => AddProjectsToSolution(settings, s)
23+
));
24+
}
25+
26+
private static void AddProjectsToSolution(TemplateSettings settings, IEnumerable<string> fileNames)
27+
{
28+
var projectFiles = fileNames
29+
.Where(f => f.EndsWith(".csproj"))
30+
.ToList();
31+
var solutionFilename = Path.Combine(settings.TargetDirectory, $"{settings.AppName}.sln");
32+
var rootGuid = GetRootGuid(solutionFilename);
33+
if(projectFiles.Any())
34+
{
35+
36+
foreach (var file in projectFiles)
37+
{
38+
var filename = Path.GetFileNameWithoutExtension(file);
39+
var relativePath = Path.GetRelativePath(settings.TargetDirectory, file);
40+
var str = $"Project(\"{rootGuid}\") = \"{filename}\", \"{relativePath}\", \"{Guid.NewGuid()}\"\r\nEndProject\r\n";
41+
using var fileWriter = File.AppendText(solutionFilename);
42+
fileWriter.Write(str);
43+
}
44+
}
45+
}
46+
47+
private static string GetRootGuid(string solutionFilename)
48+
{
49+
var lines = File.ReadAllText(Path.Combine(solutionFilename));
50+
if (lines.Any())
51+
{
52+
var match = Regex.Match(lines, "Project.+(\\{.+\\}).+StartProject");
53+
return match.Groups[1].Value;
54+
}
55+
return "";
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)