Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
Merge pull request #103 from brandondahler/features/MetadataOnly_Appe…
Browse files Browse the repository at this point in the history
…ndToVersion

Allow metadata-only AppendToVersion
  • Loading branch information
mcasperson authored Jan 13, 2019
2 parents 096c446 + 4fbd449 commit 2e5098c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source/OctoPack.Tasks/CreateOctoPackPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,11 @@ private void UpdateVersionWithAppendValue(XContainer nuSpec)

var version = GetVersionElementFromNuSpec(nuSpec);

version.Value = $"{PackageVersion ?? version.Value}-{AppendToVersion.Trim()}";
if (AppendToVersion[0] != '+')
version.Value = $"{PackageVersion ?? version.Value}-{AppendToVersion.Trim()}";
else
version.Value = $"{PackageVersion ?? version.Value}{AppendToVersion.Trim()}";

PackageVersion = version.Value;
}

Expand Down
48 changes: 48 additions & 0 deletions source/OctoPack.Tests/Integration/SampleSolutionBuildFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,54 @@ public void ShouldAllowAppendingValueToVersionWithExplicitPackageVersion()
"Web.Debug.config"));
}

[Test]
public void ShouldAllowAppendingValueToVersionWithMetadataOnly()
{
MsBuild("Samples.sln /p:RunOctoPack=true /p:OctoPackAppendToVersion=+Foo /p:Configuration=Release /v:m");

AssertPackage(@"Sample.ConsoleApp\obj\octopacked\Sample.ConsoleApp.2.1.0.1+Foo.nupkg",
pkg => pkg.AssertContents(
"Sample.ConsoleApp.exe",
"Sample.ConsoleApp.exe.config",
"Sample.ConsoleApp.pdb"));

AssertPackage(@"Sample.WebApp\obj\octopacked\Sample.WebApp.3.1.0-dev+Foo.nupkg",
pkg => pkg.AssertContents(
"bin\\*.dll",
"bin\\*.xml",
"bin\\Sample.WebApp.dll",
"bin\\Sample.WebApp.pdb",
"Content\\*.css",
"Content\\*.png",
"Content\\LinkedFile.txt",
"Scripts\\*.js",
"Views\\Web.config",
"Views\\*.cshtml",
"Global.asax",
"Web.config",
"Web.Release.config",
"Web.Debug.config"));

AssertPackage(@"Sample.WebAppWithSpec\obj\octopacked\Sample.WebAppWithSpec.1.0.13-demo+Foo.nupkg",
pkg => pkg.AssertContents(
"bin\\*.dll",
"bin\\*.xml",
"bin\\Sample.WebAppWithSpec.dll",
"bin\\Sample.WebAppWithSpec.pdb",
"Content\\*.css",
"Content\\*.png",
"Content\\LinkedFile.txt",
"Scripts\\*.js",
"Views\\Web.config",
"Views\\*.cshtml",
"Views\\Deploy.ps1",
"Deploy.ps1",
"Global.asax",
"Web.config",
"Web.Release.config",
"Web.Debug.config"));
}

[Test]
public void ShouldSupportRelativeOutputDirectories()
{
Expand Down

0 comments on commit 2e5098c

Please sign in to comment.