Skip to content

Commit

Permalink
Merge branch 'release/0.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed Sep 26, 2018
2 parents a5b0f13 + 9172956 commit 49c3d0f
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 14 deletions.
2 changes: 1 addition & 1 deletion nuspec/nuget/Cake.DocFx.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<copyright>Copyright (c) Cake Contributions 2016 - Present</copyright>
<tags>Cake Script DocFx</tags>
<releaseNotes>https://github.com/cake-contrib/Cake.DocFx/releases/tag/0.8.0</releaseNotes>
<releaseNotes>https://github.com/cake-contrib/Cake.DocFx/releases/tag/0.9.0</releaseNotes>
</metadata>
<files>
<file src="netstandard2.0\Cake.DocFx.dll" target="lib\netstandard2.0" />
Expand Down
75 changes: 74 additions & 1 deletion src/Cake.DocFx.Tests/Metadata/DocFxMetadataRunnerTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Xunit;
using Cake.Core.IO;
using System.Collections.Generic;
using Xunit;

namespace Cake.DocFx.Tests.Metadata
{
Expand All @@ -22,6 +24,77 @@ public void Should_Throw_If_Settings_Are_Null()
result.IsArgumentNullException("settings");
}

[Fact]
public void Should_Add_Project_To_Arguments_If_Set()
{
// Given
var fixture = new DocFxMetadataRunnerFixture
{
Settings = { Projects = new List<FilePath> { @"c:\temp\docfx.json" } }
};

// When
var result = fixture.Run();

// Then
Assert.Equal("metadata \"c:/temp/docfx.json\"", result.Args);
}

[Fact]
public void Should_Add_Project_With_Space_In_Path_To_Arguments_If_Set()
{
// Given
var fixture = new DocFxMetadataRunnerFixture
{
Settings = { Projects = new List<FilePath> { @"c:\foo bar\docfx.json" } }
};

// When
var result = fixture.Run();

// Then
Assert.Equal("metadata \"c:/foo bar/docfx.json\"", result.Args);
}

[Fact]
public void Should_Add_Multiple_Projects_To_Arguments_If_Set()
{
// Given
var fixture = new DocFxMetadataRunnerFixture
{
Settings =
{
Projects = new List<FilePath>
{
@"c:\temp\foo.csproj",
@"c:\temp\bar.csproj"
}
}
};

// When
var result = fixture.Run();

// Then
Assert.Equal("metadata \"c:/temp/foo.csproj\",\"c:/temp/bar.csproj\"", result.Args);
}

[Fact]
public void Should_Add_OutputPath_To_Arguments_If_Set()
{
// Given
var fixture = new DocFxMetadataRunnerFixture
{
Settings = { OutputPath = @"c:\temp\api" }
};

// When
var result = fixture.Run();

// Then
Assert.Equal("metadata -o \"c:/temp/api\"", result.Args);
}

[Fact]
public void Should_Add_LogPath_To_Arguments_If_Set()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.DocFx/Metadata/DocFxMetadataRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private ProcessArgumentBuilder GetArguments(DocFxMetadataSettings settings)

// parameters
if (settings.Projects != null && settings.Projects.Any())
builder.Append(string.Join(",", settings.Projects.Select(val => val.FullPath)));
builder.Append(string.Join(",", settings.Projects.Select(val => "\"" + val.FullPath + "\"")));

#region DupFinder Exclusion
if (settings.OutputPath != null)
Expand Down
29 changes: 20 additions & 9 deletions src/Cake.DocFx/Metadata/DocFxMetadataSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,30 @@ namespace Cake.DocFx.Metadata
public class DocFxMetadataSettings : ToolSettings
{
/// <summary>
/// Specifies the projects to have metadata extracted. There are several approaches to extract language metadata.
/// 1. From a supported project file or project file list
/// Supported project file extensions include .csproj, .vbproj, .sln.
/// 2. From a supported source code file or source code file list
/// Supported source code file extensions include .cs and .vb. Files can be combined using , as seperator and search
/// pattern.
/// 3. From docfx.json file. If the argument is not specified, docfx.exe will try reading docfx.json under current
/// directory.
/// Specifies the projects to have metadata extracted. There are several approaches to extract language metadata.
/// <list type="number">
/// <item>
/// <description>
/// From a supported project file or project file list.
/// Supported project file extensions include .csproj, .vbproj, .sln.
/// </description>
/// </item>
/// <item>
/// <description>
/// From a supported source code file or source code file list.
/// Supported source code file extensions include .cs and .vb. Files can be combined using , as seperator and search pattern.
/// </description>
/// </item>
/// <item>
/// <description>From docfx.json file.</description>
/// </item>
/// </list>
/// If the argument is not specified, docfx.exe will try reading docfx.json under current directory.
/// </summary>
public IEnumerable<FilePath> Projects { get; set; }

/// <summary>
/// Gets or sets the output folder. The default is api, and is configured in the 'metadata' section of docfx.json.
/// Gets or sets the output folder. The default is <c>api</c>, and is configured in the 'metadata' section of docfx.json.
/// </summary>
public DirectoryPath OutputPath { get; set; }

Expand Down
4 changes: 2 additions & 2 deletions tools/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.23.0" />
</packages>
<package id="Cake" version="0.30.0" />
</packages>

0 comments on commit 49c3d0f

Please sign in to comment.