From 98d2248963c106f36d9669ea7754ad5d06473a5b Mon Sep 17 00:00:00 2001 From: Dave Glick Date: Thu, 3 Oct 2019 08:53:12 -0400 Subject: [PATCH] No longer strips "Pipeline" suffix from pipeline classes --- RELEASE.md | 1 + .../Execution/IPipelineCollection.AddDefaults.cs | 8 +++----- .../Execution/ExecutionPipelineFixture.cs | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index d119461de..7a2abc550 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -3,6 +3,7 @@ - Adds back a `ExecuteModules` module that works like the old `Branch` module used to by dropping any output documents from the child modules. - Tweaks to the placeholder factory in `CreateTree`. - Fix for the JavaScript engine getting reset on execution. +- No longer strips "Pipeline" from the end of pipeline classes for the pipeline name since `nameof` is often used to refer to pipelines. # 1.0.0-alpha.5 diff --git a/src/core/Statiq.Common/Execution/IPipelineCollection.AddDefaults.cs b/src/core/Statiq.Common/Execution/IPipelineCollection.AddDefaults.cs index 567831ecd..c0657ee91 100644 --- a/src/core/Statiq.Common/Execution/IPipelineCollection.AddDefaults.cs +++ b/src/core/Statiq.Common/Execution/IPipelineCollection.AddDefaults.cs @@ -7,12 +7,10 @@ namespace Statiq.Common /// public partial interface IPipelineCollection { - public void Add(IPipeline pipeline) => Add(pipeline?.GetType().Name.RemoveEnd("Pipeline", StringComparison.OrdinalIgnoreCase), pipeline); + public void Add(IPipeline pipeline) => Add(pipeline?.GetType().Name, pipeline); public IPipeline Add(Type pipelineType) => - Add( - pipelineType ?? throw new ArgumentNullException(nameof(pipelineType)), - pipelineType.Name.RemoveEnd("Pipeline", StringComparison.OrdinalIgnoreCase)); + Add(pipelineType ?? throw new ArgumentNullException(nameof(pipelineType)), pipelineType.Name); public IPipeline Add(Type pipelineType, string name) { @@ -28,7 +26,7 @@ public IPipeline Add(Type pipelineType, string name) public IPipeline Add() where TPipeline : IPipeline => - Add(typeof(TPipeline).Name.RemoveEnd("Pipeline", StringComparison.OrdinalIgnoreCase)); + Add(typeof(TPipeline).Name); public IPipeline Add(string name) where TPipeline : IPipeline diff --git a/tests/core/Statiq.Core.Tests/Execution/ExecutionPipelineFixture.cs b/tests/core/Statiq.Core.Tests/Execution/ExecutionPipelineFixture.cs index 1ac4d633a..f1ded7106 100644 --- a/tests/core/Statiq.Core.Tests/Execution/ExecutionPipelineFixture.cs +++ b/tests/core/Statiq.Core.Tests/Execution/ExecutionPipelineFixture.cs @@ -29,7 +29,7 @@ public async Task ExecutesCorrectPipelines() IPipelineOutputs outputs = await engine.ExecuteAsync(cts); // Then - outputs["TestExecution"].Cast().Select(x => x.Content).Single().ShouldBe("Foo"); + outputs["TestExecutionPipeline"].Cast().Select(x => x.Content).Single().ShouldBe("Foo"); } }