Skip to content

Commit d2539ff

Browse files
SirMetathystSirMetathyst
authored andcommitted
Updated ProjectUnit and Build Scripts
1 parent 6a5e036 commit d2539ff

6 files changed

Lines changed: 63 additions & 62 deletions

File tree

Clean.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
# Clean Psythyst.Core
2-
rm -rf ./Psythyst.Core/bin
3-
rm -rf ./Psythyst.Core/obj
4-
rm -rf ./Psythyst.Core/Publish
5-
6-
# Clean Psythyst
7-
rm -rf ./Psythyst/Psythyst/bin
8-
rm -rf ./Psythyst/Psythyst/obj
9-
rm -rf ./Psythyst/Psythyst/Publish
10-
11-
# Clean
1+
# Clean Psythyst.Core
2+
rm -rf ./Psythyst.Core/bin
3+
rm -rf ./Psythyst.Core/obj
4+
rm -rf ./Psythyst.Core/Publish
5+
rm -rf ./Psythyst.Core/Package
6+
7+
# Clean Psythyst
8+
rm -rf ./Psythyst/Psythyst/bin
9+
rm -rf ./Psythyst/Psythyst/obj
10+
rm -rf ./Psythyst/Psythyst/Publish
11+
rm -rf ./Psythyst/Psythyst/Package
12+
13+
# Clean
1214
rm -rf ./Publish

Docker-Extract.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
mkdir -p ./Publish
2-
DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3-
4-
DOCKER_VOLUME="$DIRECTORY/Publish:/Publish"
5-
DOCKER_COMMAND="cp -R /Psythyst.Core/Publish /"
6-
DOCKER_IMAGE="psythyst/psythyst-core:latest"
7-
1+
mkdir -p ./Publish
2+
DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3+
4+
DOCKER_VOLUME="$DIRECTORY/Publish:/Publish"
5+
DOCKER_COMMAND="cp -R /Psythyst.Core/Publish /"
6+
DOCKER_IMAGE="psythyst/psythyst-core:latest"
7+
88
docker run -it --rm -v $DOCKER_VOLUME $DOCKER_IMAGE $DOCKER_COMMAND

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
FROM microsoft/dotnet:sdk AS Build
2-
3-
# Build Psythyst
4-
WORKDIR /
5-
COPY ./ ./
6-
RUN dotnet restore
1+
FROM microsoft/dotnet:sdk AS Build
2+
3+
# Build Psythyst
4+
WORKDIR /
5+
COPY ./ ./
6+
RUN dotnet restore
77
RUN dotnet publish -c Release -o ./Publish

Psythyst.Core/Psythyst.Core.csproj

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
2-
3-
<ItemGroup>
4-
<ProjectReference Include="..\Psythyst\Psythyst\Psythyst.csproj" />
5-
</ItemGroup>
6-
7-
<PropertyGroup>
8-
<TargetFramework>netstandard2.0</TargetFramework>
9-
</PropertyGroup>
10-
11-
<PropertyGroup>
12-
<VersionPrefix>1.0.0</VersionPrefix>
13-
<!--<VersionSuffix>stable</VersionSuffix>-->
14-
</PropertyGroup>
15-
16-
<PropertyGroup>
17-
<Title>Psythyst.Core</Title>
18-
<PackageId>Psythyst.Core</PackageId>
19-
<PackageVersion>1.0.0</PackageVersion>
20-
<PackageProjectUrl>https://github.com/Psythyst/Psythyst.Core</PackageProjectUrl>
21-
<PackageLicenseUrl>https://github.com/Psythyst/Psythyst.Core/blob/develop/LICENCE.txt</PackageLicenseUrl>
22-
<RepositoryUrl>https://github.com/Psythyst/Psythyst.Core</RepositoryUrl>
23-
<Authors>SirMetathyst</Authors>
24-
<Description>Psythyst CodeGenerator Core</Description>
25-
<PackageReleaseNotes></PackageReleaseNotes>
26-
<Copyright>Copyright 2017 (c) Alexander Hunt.</Copyright>
27-
<PackageTags>CodeGenerator,Psythyst,Core</PackageTags>
28-
</PropertyGroup>
29-
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<ItemGroup>
4+
<ProjectReference Include="..\Psythyst\Psythyst\Psythyst.csproj" />
5+
</ItemGroup>
6+
7+
<PropertyGroup>
8+
<TargetFramework>netstandard1.0</TargetFramework>
9+
</PropertyGroup>
10+
11+
<PropertyGroup>
12+
<VersionPrefix>1.0.0</VersionPrefix>
13+
<!--<VersionSuffix>stable</VersionSuffix>-->
14+
</PropertyGroup>
15+
16+
<PropertyGroup>
17+
<Title>Psythyst.Core</Title>
18+
<PackageId>Psythyst.Core</PackageId>
19+
<PackageVersion>1.0.0</PackageVersion>
20+
<PackageProjectUrl>https://github.com/Psythyst/Psythyst.Core</PackageProjectUrl>
21+
<PackageLicenseUrl>https://github.com/Psythyst/Psythyst.Core/blob/develop/LICENCE.txt</PackageLicenseUrl>
22+
<RepositoryUrl>https://github.com/Psythyst/Psythyst.Core</RepositoryUrl>
23+
<Authors>SirMetathyst</Authors>
24+
<Description>Psythyst CodeGenerator Core</Description>
25+
<PackageReleaseNotes></PackageReleaseNotes>
26+
<Copyright>Copyright 2017 (c) Alexander Hunt.</Copyright>
27+
<PackageTags>CodeGenerator,Psythyst,Core</PackageTags>
28+
</PropertyGroup>
29+
3030
</Project>

Psythyst.Core/Source/ProjectUnit.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ public class ProjectUnit<TSource, TResult> : IProjectUnit<TSource, TResult>
1616

1717
public IProjectUnit<TSource, TResult> AddGenerator(IGenerator<TSource, TResult> Generator, bool Condition = true)
1818
{
19-
if(Condition) _Generator.Add(Generator.ToString(), Generator); return this;
19+
if(Condition && Generator != null) _Generator.Add(Generator.ToString(), Generator); return this;
2020
}
2121

2222
public IProjectUnit<TSource, TResult> AddGeneratorCollection(IEnumerable<IGenerator<TSource, TResult>> Collection, bool Condition = true)
2323
{
24-
if(Condition) Collection.Each(x => _Generator.Add(x.ToString(), x)); return this;
24+
if(Condition && Collection != null) Collection.Each(x => { if (x != null) _Generator.Add(x.ToString(), x); }); return this;
2525
}
2626

2727
public IProjectUnit<TSource, TResult> AddPostProcessor(IPostProcessor<TResult> PostProcessor, bool Condition = true)
2828
{
29-
if(Condition) _PostProcessor.Add(PostProcessor.ToString(), PostProcessor); return this;
29+
if(Condition && PostProcessor != null) _PostProcessor.Add(PostProcessor.ToString(), PostProcessor); return this;
3030
}
3131

3232
public IProjectUnit<TSource, TResult> AddPostProcessorCollection(IEnumerable<IPostProcessor<TResult>> Collection, bool Condition = true)
3333
{
34-
if(Condition) Collection.Each(x => _PostProcessor.Add(x.ToString(), x)); return this;
34+
if(Condition && Collection != null) Collection.Each(x => { if (x != null) _PostProcessor.Add(x.ToString(), x); }); return this;
3535
}
3636

3737
public IEnumerable<TResult> RunGenerator(TSource Model, Action<IGenerator<TSource, TResult>, Exception> OnError = null)
@@ -46,7 +46,7 @@ public IEnumerable<TResult> RunPostProcessor(IEnumerable<TResult> ResultCollecti
4646

4747
public IEnumerable<TResult> Run(TSource Model, Action<IGenerator<TSource, TResult>, Exception> OnGeneratorError = null, Action<IPostProcessor<TResult>, Exception> OnPostProcessorError = null)
4848
{
49-
return RunPostProcessor(RunGenerator(Model, OnGeneratorError), OnPostProcessorError);
49+
return Run(Model, _Generator.Values, _PostProcessor.Values, OnGeneratorError, OnPostProcessorError);
5050
}
5151

5252
public static IProjectUnit<TSource, TResult> Create()
@@ -68,7 +68,7 @@ public static IEnumerable<TResult> RunGenerator(TSource Model, IEnumerable<IGene
6868
}
6969
catch (Exception Error)
7070
{
71-
OnError?.Invoke(Generator, Error);
71+
if(OnError != null) OnError.Invoke(Generator, Error);
7272
}
7373
}
7474

@@ -77,7 +77,6 @@ public static IEnumerable<TResult> RunGenerator(TSource Model, IEnumerable<IGene
7777

7878
public static IEnumerable<TResult> RunPostProcessor(IEnumerable<TResult> ResultCollection, IEnumerable<IPostProcessor<TResult>> PostProcessorCollection, Action<IPostProcessor<TResult>, Exception> OnError = null)
7979
{
80-
var ResultList = new List<TResult>();
8180
var _PostProcessorCollection = PostProcessorCollection.OrderByDescending(x => x.Priority);
8281
var Current = ResultCollection;
8382

@@ -89,7 +88,7 @@ public static IEnumerable<TResult> RunPostProcessor(IEnumerable<TResult> ResultC
8988
}
9089
catch (Exception Error)
9190
{
92-
OnError?.Invoke(PostProcessor, Error);
91+
if(OnError != null) OnError.Invoke(PostProcessor, Error);
9392
}
9493
}
9594

0 commit comments

Comments
 (0)