Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature toggles #303

Merged
merged 27 commits into from
Mar 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ packages/Chocolatey/
# Fody
!src/Pickles/packages/Fody*/build/*
src/Pickles/.vs/config/applicationhost.config
src/Pickles/Pickles/PortabilityAnalysis.html
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@ This project adheres to [Semantic Versioning](http://semver.org). We consider th
- The settings file of the GUI runner
- The JSON output of the JSON format

Features in Experimental are subject to change and removal without being considered breaking.

This document is formatted according to the principles of [Keep A CHANGELOG](http://keepachangelog.com).


## [Unreleased]

### Experimental

- Using a different MarkDown component. Warning: it is not entirely compatible with the static HTML version. ([#269](https://github.com/picklesdoc/pickles/issues/269)) (by [@dirkrombauts](https://github.com/dirkrombauts)).
- Enabling mathematics in the description elements in the DHTML version. Warning: requires internet connectivity. ([#281](https://github.com/picklesdoc/pickles/issues/281)) (by [@dirkrombauts](https://github.com/dirkrombauts)).

## [2.4.1] - 2016-03-01

### Fixed
Expand Down
1 change: 1 addition & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
call build.bat
6 changes: 6 additions & 0 deletions chocolatey.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Target "CreatePackage CMD" (fun _ ->
cmdDir + "PicklesDoc.Pickles.ObjectModel.dll";
cmdDir + "PicklesDoc.Pickles.TestFrameworks.dll";
cmdDir + "System.IO.Abstractions.dll";
cmdDir + "FeatureSwitcher.dll";
cmdDir + "Strike.Jint.dll";
cmdDir + "Jint.dll";
cmdDir + "pickles.exe";
cmdDir + "NLog.config" ]

Expand Down Expand Up @@ -70,6 +73,9 @@ Target "CreatePackage GUI" (fun _ ->
guiDir + "PicklesDoc.Pickles.ObjectModel.dll";
guiDir + "PicklesDoc.Pickles.TestFrameworks.dll";
guiDir + "System.IO.Abstractions.dll";
guiDir + "FeatureSwitcher.dll";
guiDir + "Strike.Jint.dll";
guiDir + "Jint.dll";
guiDir + "System.Windows.Interactivity.dll";
guiDir + "picklesui.exe";
guiDir + "NLog.config";
Expand Down
3 changes: 3 additions & 0 deletions chocolatey/pickles.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ Optionally, *Pickles* can **integrate test results**, so that your stakeholders
<file src="PicklesDoc.Pickles.ObjectModel.dll" target="tools" />
<file src="PicklesDoc.Pickles.TestFrameworks.dll" target="tools" />
<file src="System.IO.Abstractions.dll" target="tools" />
<file src="FeatureSwitcher.dll" target="tools" />
<file src="Strike.Jint.dll" target="tools" />
<file src="Jint.dll" target="tools" />
<file src="pickles.exe" target="tools" />
</files>
</package>
Expand Down
3 changes: 3 additions & 0 deletions chocolatey/picklesui.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ Optionally, *Pickles* can **integrate test results**, so that your stakeholders
<file src="PicklesDoc.Pickles.ObjectModel.dll" target="tools" />
<file src="PicklesDoc.Pickles.TestFrameworks.dll" target="tools" />
<file src="System.IO.Abstractions.dll" target="tools" />
<file src="FeatureSwitcher.dll" target="tools" />
<file src="Strike.Jint.dll" target="tools" />
<file src="Jint.dll" target="tools" />
<file src="System.Windows.Interactivity.dll" target="tools" />
<file src="picklesui.exe" target="tools" />
<file src="picklesui.exe.gui" target="tools" />
Expand Down
9 changes: 9 additions & 0 deletions nuget.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ Target "CreatePackageCommandLine" (fun _ ->
cmdDir + "PicklesDoc.Pickles.ObjectModel.dll";
cmdDir + "PicklesDoc.Pickles.TestFrameworks.dll";
cmdDir + "System.IO.Abstractions.dll";
cmdDir + "FeatureSwitcher.dll";
cmdDir + "Strike.Jint.dll";
cmdDir + "Jint.dll";
cmdDir + "pickles.exe";
cmdDir + "NLog.config" ]

Expand Down Expand Up @@ -64,6 +67,9 @@ Target "CreatePackageMsBuild" (fun _ ->
msBuildDir + "PicklesDoc.Pickles.ObjectModel.dll";
msBuildDir + "PicklesDoc.Pickles.TestFrameworks.dll";
msBuildDir + "System.IO.Abstractions.dll";
msBuildDir + "FeatureSwitcher.dll";
msBuildDir + "Strike.Jint.dll";
msBuildDir + "Jint.dll";
msBuildDir + "PicklesDoc.Pickles.MSBuild.Tasks.dll";
msBuildDir + "build/Pickles.MSBuild.targets";]

Expand Down Expand Up @@ -94,6 +100,9 @@ Target "CreatePackagePowerShell" (fun _ ->
powerShellDir + "PicklesDoc.Pickles.TestFrameworks.dll";
powerShellDir + "PicklesDoc.Pickles.PowerShell.dll";
powerShellDir + "System.IO.Abstractions.dll";
powerShellDir + "FeatureSwitcher.dll";
powerShellDir + "Strike.Jint.dll";
powerShellDir + "Jint.dll";
"src/Pickles/Pickles.PowerShell/init.ps1" ]

NuGet (fun p ->
Expand Down
9 changes: 6 additions & 3 deletions src/Pickles/Examples/Features/Arithmetic.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
Feature: Arithmetic
In order to avoid silly mistakes
As a math idiot
I want to be able to perform arithmetic on the calculator
In order to avoid silly mistakes
As a math idiot
I want to be able to perform arithmetic on the calculator

When $a \ne 0$, there are two solutions to $\(ax^2 + bx + c = 0\)$ and they are
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$

@arithmetic @fast
Scenario: Add two numbers
Expand Down
4 changes: 2 additions & 2 deletions src/Pickles/Pickles.BaseDhtmlFiles/Index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<!--[if lt IE 9]>
<script src="js/html5.js"></script>
<![endif]-->
#### EMBED EXPERIMENTALS ####
</head>

<body>
Expand Down Expand Up @@ -183,7 +184,6 @@ <h4 data-bind="text: Name, click: $root.toggleDetail" class="canHighlight, click
</div>
</div>
<!--/row-->

<!--<hr>

<footer>
Expand Down Expand Up @@ -220,7 +220,7 @@ <h4 data-bind="text: Name, click: $root.toggleDetail" class="canHighlight, click
self.currentFeature = ko.observable();
self.configuration = ko.observable(configuration);
self.ShowAllLinks = ko.observable(false);

self.setCurrentFeature = function () {
if (window.location.hash != '') {
var featureFromHashLocation = findFeatureByRelativeFolder(removeBeginningHash(window.location.hash), features);
Expand Down
3 changes: 3 additions & 0 deletions src/Pickles/Pickles.CommandLine/Pickles.CommandLine.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
<file src="PicklesDoc.Pickles.ObjectModel.dll" target="tools" />
<file src="PicklesDoc.Pickles.TestFrameworks.dll" target="tools" />
<file src="System.IO.Abstractions.dll" target="tools" />
<file src="FeatureSwitcher.dll" target="tools" />
<file src="Strike.Jint.dll" target="tools" />
<file src="Jint.dll" target="tools" />
<file src="Pickles.exe" target="tools" />
<file src="NLog.config" target="tools" />
</files>
Expand Down
3 changes: 3 additions & 0 deletions src/Pickles/Pickles.MSBuild/Pickles.MSBuild.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
<file src="PicklesDoc.Pickles.Library.dll" target="tools" />
<file src="PicklesDoc.Pickles.ObjectModel.dll" target="tools" />
<file src="PicklesDoc.Pickles.TestFrameworks.dll" target="tools" />
<file src="FeatureSwitcher.dll" target="tools" />
<file src="Strike.Jint.dll" target="tools" />
<file src="Jint.dll" target="tools" />
<file src="PicklesDoc.Pickles.MSBuild.Tasks.dll" target="tools" />
<file src="System.IO.Abstractions.dll" target="tools" />
<file src="Pickles.MSBuild.targets" target="build" />
Expand Down
12 changes: 12 additions & 0 deletions src/Pickles/Pickles.MSBuild/Pickles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public class Pickles : Task

public string DocumentationFormat { get; set; }

public string IncludeExperimentalFeatures { get; set; }

public override bool Execute()
{
try
Expand Down Expand Up @@ -109,6 +111,16 @@ private void CaptureConfiguration(IConfiguration configuration, IFileSystem file
{
configuration.DocumentationFormat = (DocumentationFormat)Enum.Parse(typeof(DocumentationFormat), this.DocumentationFormat, true);
}

bool shouldEnableExperimentalFeatures;

if (bool.TryParse(this.IncludeExperimentalFeatures, out shouldEnableExperimentalFeatures))
{
if (shouldEnableExperimentalFeatures)
{
configuration.EnableExperimentalFeatures();
}
}
}
}
}
3 changes: 2 additions & 1 deletion src/Pickles/Pickles.MSBuild/build/Pickles.MSBuild.targets
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
SystemUnderTestName="$(Pickles_SystemUnderTestName)"
SystemUnderTestVersion="$(Pickles_SystemUnderTestVersion)"
DocumentationFormat="$(Pickles_DocumentationFormat)"
Language="$(Pickles_Language)" />
Language="$(Pickles_Language)"
IncludeExperimentalFeatures="$(Pickles_IncludeExperimentalFeatures)"/>
</Target>
</Project>
6 changes: 6 additions & 0 deletions src/Pickles/Pickles.ObjectModel/IConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,14 @@ public interface IConfiguration

string SystemUnderTestVersion { get; set; }

bool ShouldIncludeExperimentalFeatures { get; }

void AddTestResultFile(FileInfoBase fileInfoBase);

void AddTestResultFiles(IEnumerable<FileInfoBase> fileInfoBases);

void EnableExperimentalFeatures();

void DisableExperimentalFeatures();
}
}
8 changes: 8 additions & 0 deletions src/Pickles/Pickles.PowerShell/Pickle_Features.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public class Pickle_Features : PSCmdlet
[Parameter(HelpMessage = CommandLineArgumentParser.HelpDocumentationFormat, Mandatory = false)]
public string DocumentationFormat { get; set; }

[Parameter(HelpMessage = CommandLineArgumentParser.HelpIncludeExperimentalFeatures, Mandatory = false)]
public SwitchParameter IncludeExperimentalFeatures { get; set; }

protected override void ProcessRecord()
{
var builder = new ContainerBuilder();
Expand Down Expand Up @@ -103,6 +106,11 @@ private void ParseParameters(IConfiguration configuration, IFileSystem fileSyste
{
configuration.Language = this.Language;
}

if (this.IncludeExperimentalFeatures.IsPresent)
{
configuration.EnableExperimentalFeatures();
}
}

private DirectoryInfoBase DetermineFeatureFolder(IFileSystem fileSystem, PathInfo currentFileSystemLocation, string directory)
Expand Down
3 changes: 3 additions & 0 deletions src/Pickles/Pickles.PowerShell/Pickles.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
<file src="PicklesDoc.Pickles.TestFrameworks.dll" target="tools" />
<file src="PicklesDoc.Pickles.PowerShell.dll" target="tools" />
<file src="System.IO.Abstractions.dll" target="tools" />
<file src="FeatureSwitcher.dll" target="tools" />
<file src="Strike.Jint.dll" target="tools" />
<file src="Jint.dll" target="tools" />
<file src="init.ps1" target="tools\init.ps1" />
</files>
</package>
10 changes: 10 additions & 0 deletions src/Pickles/Pickles.Test/BaseFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,19 @@ protected MockFileSystem FileSystem
get { return (MockFileSystem)this.Container.Resolve<IFileSystem>(); }
}

protected IConfiguration Configuration
{
get
{
return this.Container.Resolve<IConfiguration>();
}
}

[TearDown]
public void TearDown()
{
this.Configuration.DisableExperimentalFeatures();

this.container?.Dispose();

this.container = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void TestTheResourceWriter()
{
var conf = new Configuration();
conf.OutputFolder = FileSystem.DirectoryInfo.FromDirectoryName(@"d:\output");
var resourceWriter = new DhtmlResourceWriter(FileSystem);
var resourceWriter = new DhtmlResourceWriter(FileSystem, conf);
resourceWriter.WriteTo(conf.OutputFolder.FullName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.Linq;
using Autofac;
using TechTalk.SpecFlow;

Expand All @@ -34,6 +35,12 @@ public void BeforeScenario()
builder.RegisterAssemblyTypes(typeof(Runner).Assembly);
builder.RegisterModule<PicklesModule>();
CurrentScenarioContext.Container = builder.Build();

if (ScenarioContext.Current.ScenarioInfo.Tags.Contains("enableExperimentalFeatures"))
{
var configuration = CurrentScenarioContext.Container.Resolve<IConfiguration>();
configuration.EnableExperimentalFeatures();
}
}

[AfterScenario]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Feature: Formatting a Feature Using Strike

@enableExperimentalFeatures
Scenario: Description with image should render correctly

Given I have this feature description
"""
Including a picture: ![](./image.png)
"""
When I generate the documentation
Then the result should be
"""
<div id="feature">
<h1>a feature</h1>
<div class="description">
<p>Including a picture: <img src="./image.png" alt="" /></p>
</div>
<ul id="scenarios" />
</div>
"""

Scenario: Description with image with extra attributes should render correctly

Given I have this feature description
"""
Including a picture: ![alt text](./image.png "Image Title")
"""
When I generate the documentation
Then the result should be
"""
<div id="feature">
<h1>a feature</h1>
<div class="description">
<p>Including a picture: <img src="./image.png" alt="alt text" title="Image Title" /></p>
</div>
<ul id="scenarios" />
</div>
"""
Loading