From 4d2ff4312054b782b461175522dbb4aa06775b29 Mon Sep 17 00:00:00 2001 From: Dirk Rombauts Date: Tue, 14 Jun 2016 16:24:21 +0200 Subject: [PATCH] Release 2.7.0 (#351) * Enhancement to support Unix path! (#344) I'm not sure you already got a try or a feedback about it but actually pickles run relatively well under Linux with mono which is interesting when like me you can't get a windows machine. However without this little change we can't get the folder structure display correctly. Could you integrate this modification? Thanks * Release 2.6.3 (#348) * Version Bump * Update change log * Add --enableComments Flag to Command Line - Default to True (#346) * Command-Line Flag --comments - Default to True - Incl Unit Test * Changed Command Line Argument --comments to --enableComments * Added Enable Comments Option to MSBuild - Powershell - WPF Runners * Fixed Bug with enableComments Property Not Being Used in MainViewModel * Add EnableComments to the targets file * Adapt change log * Version bump to 2.7.0 --- CHANGELOG.md | 6 +++ build.bat | 2 +- src/Pickles/.vs/config/applicationhost.config | 2 +- src/Pickles/Pickles.MSBuild/Pickles.cs | 12 +++++ .../build/Pickles.MSBuild.targets | 3 +- .../Pickles.ObjectModel/IConfiguration.cs | 6 +++ .../Pickles.PowerShell/Pickle_Features.cs | 18 ++++++++ .../Pickles.Test/ObjectModel/Factory.cs | 6 +++ .../ObjectModel/MapperTestsForFeature.cs | 44 +++++++++++++++++++ .../Pickles.UserInterface/MainWindow.xaml | 9 ++-- .../Settings/MainModel.cs | 3 ++ .../ViewModel/MainViewModel.cs | 21 ++++++++- .../Pickles/CommandLineArgumentParser.cs | 11 ++++- src/Pickles/Pickles/Configuration.cs | 13 +++++- src/Pickles/Pickles/FeatureParser.cs | 2 +- src/Pickles/Pickles/ObjectModel/Mapper.cs | 18 ++++++-- src/Pickles/VersionInfo.cs | 8 ++-- 17 files changed, 165 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1888b88e..88d8d9ee2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,12 @@ Features in Experimental are subject to change and removal without being conside This document is formatted according to the principles of [Keep A CHANGELOG](http://keepachangelog.com). +## [2.7.0] - 2016-06-14 + +### Added + +- Make #-style comments configurable - Default to True ([346](https://github.com/picklesdoc/pickles/issues/346)) (by [@ocsurfnut](https://github.com/ocsurfnut)). + ## [2.6.3] - 2016-05-24 ### Fixed diff --git a/build.bat b/build.bat index e7e0f854a..ee47b56e3 100644 --- a/build.bat +++ b/build.bat @@ -1,5 +1,5 @@ @echo off -set "picklesVersion=2.6.3" +set "picklesVersion=2.7.0" cls diff --git a/src/Pickles/.vs/config/applicationhost.config b/src/Pickles/.vs/config/applicationhost.config index 78bf2029c..cd120d363 100644 --- a/src/Pickles/.vs/config/applicationhost.config +++ b/src/Pickles/.vs/config/applicationhost.config @@ -163,7 +163,7 @@ - + diff --git a/src/Pickles/Pickles.MSBuild/Pickles.cs b/src/Pickles/Pickles.MSBuild/Pickles.cs index 1e4a23627..9ecf759c7 100644 --- a/src/Pickles/Pickles.MSBuild/Pickles.cs +++ b/src/Pickles/Pickles.MSBuild/Pickles.cs @@ -49,6 +49,8 @@ public class Pickles : Task public string IncludeExperimentalFeatures { get; set; } + public string EnableComments { get; set; } + public override bool Execute() { try @@ -121,6 +123,16 @@ private void CaptureConfiguration(IConfiguration configuration, IFileSystem file configuration.EnableExperimentalFeatures(); } } + + bool shouldEnableComments; + + if (bool.TryParse(this.EnableComments, out shouldEnableComments)) + { + if (!shouldEnableComments) + { + configuration.DisableComments(); + } + } } } } diff --git a/src/Pickles/Pickles.MSBuild/build/Pickles.MSBuild.targets b/src/Pickles/Pickles.MSBuild/build/Pickles.MSBuild.targets index 9856b836a..ad3079f1c 100644 --- a/src/Pickles/Pickles.MSBuild/build/Pickles.MSBuild.targets +++ b/src/Pickles/Pickles.MSBuild/build/Pickles.MSBuild.targets @@ -18,6 +18,7 @@ SystemUnderTestVersion="$(Pickles_SystemUnderTestVersion)" DocumentationFormat="$(Pickles_DocumentationFormat)" Language="$(Pickles_Language)" - IncludeExperimentalFeatures="$(Pickles_IncludeExperimentalFeatures)"/> + IncludeExperimentalFeatures="$(Pickles_IncludeExperimentalFeatures)" + EnableComments="$(Pickles_EnableComments)" /> \ No newline at end of file diff --git a/src/Pickles/Pickles.ObjectModel/IConfiguration.cs b/src/Pickles/Pickles.ObjectModel/IConfiguration.cs index 725e0eabf..0269aeabe 100644 --- a/src/Pickles/Pickles.ObjectModel/IConfiguration.cs +++ b/src/Pickles/Pickles.ObjectModel/IConfiguration.cs @@ -54,5 +54,11 @@ public interface IConfiguration void EnableExperimentalFeatures(); void DisableExperimentalFeatures(); + + bool ShouldEnableComments { get; } + + void EnableComments(); + + void DisableComments(); } } \ No newline at end of file diff --git a/src/Pickles/Pickles.PowerShell/Pickle_Features.cs b/src/Pickles/Pickles.PowerShell/Pickle_Features.cs index a646d32d0..0e015b223 100644 --- a/src/Pickles/Pickles.PowerShell/Pickle_Features.cs +++ b/src/Pickles/Pickles.PowerShell/Pickle_Features.cs @@ -58,6 +58,9 @@ public class Pickle_Features : PSCmdlet [Parameter(HelpMessage = CommandLineArgumentParser.HelpIncludeExperimentalFeatures, Mandatory = false)] public SwitchParameter IncludeExperimentalFeatures { get; set; } + [Parameter(HelpMessage = CommandLineArgumentParser.HelpEnableComments, Mandatory = false)] + public string EnableComments { get; set; } + protected override void ProcessRecord() { var builder = new ContainerBuilder(); @@ -111,6 +114,21 @@ private void ParseParameters(IConfiguration configuration, IFileSystem fileSyste { configuration.EnableExperimentalFeatures(); } + + if (this.IncludeExperimentalFeatures.IsPresent) + { + configuration.EnableExperimentalFeatures(); + } + + bool shouldEnableComments; + + if (bool.TryParse(this.EnableComments, out shouldEnableComments)) + { + if (!shouldEnableComments) + { + configuration.DisableComments(); + } + } } private DirectoryInfoBase DetermineFeatureFolder(IFileSystem fileSystem, PathInfo currentFileSystemLocation, string directory) diff --git a/src/Pickles/Pickles.Test/ObjectModel/Factory.cs b/src/Pickles/Pickles.Test/ObjectModel/Factory.cs index b1ebcbc8a..e4b62aca3 100644 --- a/src/Pickles/Pickles.Test/ObjectModel/Factory.cs +++ b/src/Pickles/Pickles.Test/ObjectModel/Factory.cs @@ -35,6 +35,12 @@ internal Mapper CreateMapper(string defaultLanguage = "en") return mapper; } + internal Mapper CreateMapper(IConfiguration configuration, string defaultLanguage = "en") + { + var mapper = new Mapper(configuration, defaultLanguage); + return mapper; + } + internal G.TableCell CreateGherkinTableCell(string cellValue) { return new G.TableCell(AnyLocation, cellValue); diff --git a/src/Pickles/Pickles.Test/ObjectModel/MapperTestsForFeature.cs b/src/Pickles/Pickles.Test/ObjectModel/MapperTestsForFeature.cs index ab99086d5..2a0b3d4d7 100644 --- a/src/Pickles/Pickles.Test/ObjectModel/MapperTestsForFeature.cs +++ b/src/Pickles/Pickles.Test/ObjectModel/MapperTestsForFeature.cs @@ -172,5 +172,49 @@ public void MapToFeature_FeatureWithComments_ReturnsFeatureWithComments() Check.That(scenario.Steps[3].Comments[0].Text).IsEqualTo("# line comment before the last step"); Check.That(scenario.Steps[3].Comments[1].Text).IsEqualTo("# line comment after the last step"); } + + [Test] + public void MapToFeature_FeatureWithComments_ReturnsFeatureWithoutComments_WhenConfigurationSpecifies() + { + var gherkinDocument = this.factory.CreateGherkinDocument( + "My Feature", + string.Empty, + location: new G.Location(2, 0), + comments: new G.Comment[] + { + this.factory.CreateComment("# single line comment before the given step", 4, 4), + this.factory.CreateComment("# multiline comment before the then step - line 1", 6, 4), + this.factory.CreateComment("# multiline comment before the then step - line 2", 7, 4), + this.factory.CreateComment("# line comment before the last step", 10, 4), + this.factory.CreateComment("# line comment after the last step", 12, 4), + }, + scenarioDefinitions: new G.ScenarioDefinition[] + { + this.factory.CreateScenario( + new string[0], "My scenario", string.Empty, + new G.Step[] + { + this.factory.CreateStep("Given", "I am on the first step", 5, 4), + this.factory.CreateStep("When", "I am on the second step", 8, 4), + this.factory.CreateStep("When", "there is a third step without comment", 9, 4), + this.factory.CreateStep("Then", "I am on the last step", 11, 4) + }, + location: new G.Location(3, 0) + ) + }); + + IConfiguration configuration = new Configuration(); + configuration.DisableComments(); + + var mapper = this.factory.CreateMapper(configuration); + + var result = mapper.MapToFeature(gherkinDocument); + var scenario = result.FeatureElements[0]; + + Check.That(scenario.Steps[0].Comments.Count).IsEqualTo(0); + Check.That(scenario.Steps[1].Comments.Count).IsEqualTo(0); + Check.That(scenario.Steps[2].Comments.Count).IsEqualTo(0); + Check.That(scenario.Steps[3].Comments.Count).IsEqualTo(0); + } } } \ No newline at end of file diff --git a/src/Pickles/Pickles.UserInterface/MainWindow.xaml b/src/Pickles/Pickles.UserInterface/MainWindow.xaml index 8aa1fe981..8dd4b36f8 100644 --- a/src/Pickles/Pickles.UserInterface/MainWindow.xaml +++ b/src/Pickles/Pickles.UserInterface/MainWindow.xaml @@ -47,6 +47,7 @@ + @@ -109,10 +110,10 @@ - - + + -