Skip to content

Commit

Permalink
Merge branch 'djdelaney-feature/nugetpackoptions' into develop
Browse files Browse the repository at this point in the history
* djdelaney-feature/nugetpackoptions:
  Expose the Tool nuget pack option in Cake
  • Loading branch information
devlead committed Dec 13, 2017
2 parents b9cb617 + b54fdd6 commit e6452fb
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ public void Should_Set_Symbols_To_False_By_Default()
// Then
Assert.False(settings.Symbols);
}

[Fact]
public void Should_Set_OutputToToolFolder_To_False_By_Default()
{
// Given, When
var settings = new NuGetPackSettings();

// Then
Assert.False(settings.OutputToToolFolder);
}
}
}
}
14 changes: 14 additions & 0 deletions src/Cake.Common.Tests/Unit/Tools/NuGet/Pack/NuGetPackerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,20 @@ public void Should_Pack_If_Sufficient_Settings_For_MetaPackage_With_TargetFrameW
Resources.Nuspec_Metadata_WithTargetFrameworkDependencies.NormalizeLineEndings(),
result.NuspecContent.NormalizeLineEndings());
}

[Fact]
public void Should_Add_Tool_Flag_To_Arguments_If_Set()
{
// Given
var fixture = new NuGetPackerWithNuSpecFixture();
fixture.Settings.OutputToToolFolder = true;

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

// Then
Assert.Equal("pack \"/Working/existing.temp.nuspec\" -Tool", result.Args);
}
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/Cake.Common/Tools/NuGet/Pack/NuGetPackSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,14 @@ public sealed class NuGetPackSettings : ToolSettings
/// </summary>
/// <value>The package language.</value>
public string Language { get; set; }

/// <summary>
/// Gets or sets a value indicating whether the files should be packed into the tool folder.
/// Defaults to <c>false</c>.
/// </summary>
/// <value>
/// <c>true</c> if the output should be placed in the tool folder inside the nuget package; otherwise <c>false</c>.
/// </value>
public bool OutputToToolFolder { get; set; }
}
}
6 changes: 6 additions & 0 deletions src/Cake.Common/Tools/NuGet/Pack/NuGetPacker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ private ProcessArgumentBuilder GetArguments(FilePath filePath, NuGetPackSettings
builder.Append(settings.MSBuildVersion.Value.ToString("D"));
}

// Use the tool folder
if (settings.OutputToToolFolder)
{
builder.Append("-Tool");
}

// Properties
if (settings.Properties != null && settings.Properties.Count > 0)
{
Expand Down

0 comments on commit e6452fb

Please sign in to comment.