Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.

Commit c49298a

Browse files
author
Jérémie Bertrand
committed
Add FileAndEnvironmentOutputType
And fix release description
1 parent 7868552 commit c49298a

6 files changed

Lines changed: 31 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Parameters:
1919

2020
- `-r=[filename]`: Release notes file path to parse (default: ReleaseNotes.md)
2121
- `-o=[filename]`: Path of the resulting file (default: ReleaseNotes.html
22-
- `-t=[file|environment]`: Type of output (default: file)
22+
- `-t=[file|environment|fileandenvironment]`: Type of output (default: file)
2323
- `-f=[Html|Markdown]`: Format of the resulting file [(default: Html)
2424
- `-g=[Sections|Categories]`: Defines the grouping of items (default: Sections)
2525
- `--template`: Path of the liquid template file to format the result ; Overrides type, format and groupby of output

SemanticReleaseNotesParser.Tests/ProgramTest.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,23 @@ public void Run_Environment()
181181
Assert.Equal(ExpectedHtml, _environmentVariables["SemanticReleaseNotes"].Trim());
182182
}
183183

184+
[Fact]
185+
public void Run_FileAndEnvironment()
186+
{
187+
// arrange
188+
Program.FileSystem = GetFileSystem();
189+
Program.Environment = GetEnvironment();
190+
Program.WebClientFactory = GetWebClientFactory();
191+
192+
// act
193+
Program.Main(new[] { "-t=fileandenvironment" });
194+
195+
// assert
196+
Assert.Equal(0, _exitCode);
197+
Assert.Equal(ExpectedHtml, Program.FileSystem.File.ReadAllText("ReleaseNotes.html").Trim());
198+
Assert.Equal(ExpectedHtml, _environmentVariables["SemanticReleaseNotes"].Trim());
199+
}
200+
184201
[Fact]
185202
public void Run_Environment_AppVeyor()
186203
{

SemanticReleaseNotesParser/Arguments.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ private Arguments()
3737

3838
ReleaseNotesPath = DefaultReleaseNotesPath;
3939
ResultFilePath = "ReleaseNotes.html";
40+
OutputType = OutputType.File;
4041
}
4142

4243
public static Arguments ParseArguments(IEnumerable<string> args)
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
namespace SemanticReleaseNotesParser
1+
using System;
2+
3+
namespace SemanticReleaseNotesParser
24
{
5+
[Flags]
36
internal enum OutputType
47
{
5-
File,
6-
Environment
8+
File = 1,
9+
Environment = 2,
10+
FileAndEnvironment = File | Environment
711
}
812
}

SemanticReleaseNotesParser/Program.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,14 @@ private static int Run(string[] args)
8080
string formattedReleaseNotes = SemanticReleaseNotesFormatter.Format(releaseNotes, formatterSettings);
8181

8282
// Select output
83-
if (arguments.OutputType == OutputType.File)
83+
if (arguments.OutputType.HasFlag(OutputType.File))
8484
{
8585
Logger.Debug("File output");
8686
FileSystem.File.WriteAllText(arguments.ResultFilePath, formattedReleaseNotes);
8787
Logger.Info("File '{0}' generated", arguments.ResultFilePath);
8888
}
89-
else if (arguments.OutputType == OutputType.Environment)
89+
90+
if (arguments.OutputType.HasFlag(OutputType.Environment))
9091
{
9192
Logger.Debug("Environment output");
9293
var buildServer = GetApplicableBuildServer();

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ after_build:
3232
- inspectcode /o="inspectcodereport.xml" "SemanticReleaseNotesParser.sln"
3333
#- NVika buildserver "inspectcodereport.xml" --debug --includesource
3434
- ilrepack /internalize /parallel /wildcards /out:SemanticReleaseNotesParser.exe SemanticReleaseNotesParser/bin/Release/SemanticReleaseNotesParser.exe SemanticReleaseNotesParser/bin/Release/*.dll
35-
- SemanticReleaseNotesParser.exe -g Categories
35+
- SemanticReleaseNotesParser.exe -g Categories -t FileAndEnvironment
3636
# build chocolatey package
3737
- ps: (gc PackagingAssets\chocolatey\tools\chocolateyInstall.ps1).replace('{{version}}', $env:GitVersion_NuGetVersion).replace('{{tag}}',$env:appveyor_repo_tag_name)|sc PackagingAssets\chocolatey\tools\chocolateyInstall.ps1
3838
- nuget pack PackagingAssets\chocolatey\SemanticReleaseNotesParser.nuspec -Version %GitVersion_NuGetVersion% -NoPackageAnalysis -NonInteractive -OutputDirectory %appveyor_build_folder%\PackagingAssets\chocolatey\
@@ -77,7 +77,7 @@ deploy:
7777
auth_token:
7878
secure: WaNF2IUzat+PQQqquLoaN43QIpnUsrYgSOGN3P5Tpy+A+ANOWQqvWE0eFA+XwmmX
7979
artifact: SemanticReleaseNotesParser.zip
80-
description: $(releaseDescription)
80+
description: $(SemanticReleaseNotes)
8181
on:
8282
appveyor_repo_tag: true
8383

0 commit comments

Comments
 (0)