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

Add publish to IYarnRunnerCommands #41

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions src/Cake.Yarn.Tests/YarnPublishTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ public void New_Version_Option_Should_Format_Correctly()
result.Args.ShouldBe($"publish --new-version {major}.{minor}.{patch}");
}

[Fact]
public void New_Version_Option_Should_Pass_Through_String()
{
const string version = "2016.9.1-rc1";

_fixture.PublishSettings = s => s.NewVersion(version);

var result = _fixture.Run();

result.Args.ShouldBe($"publish --new-version {version}");
}

[Fact]
public void Tag_Option_Should_Use_Tag_Argument()
{
Expand Down
15 changes: 11 additions & 4 deletions src/Cake.Yarn/IYarnRunnerCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,18 @@ public interface IYarnRunnerCommands
/// <param name="versionSettings">options when running 'yarn version'</param>
IYarnRunnerCommands Version(Action<YarnVersionSettings> versionSettings = null);

/// <summary>
/// execute 'yarn audit' with options
/// </summary>
/// <param name="auditSettings">options when running 'yarn audit'</param>
/// <summary>
/// execute 'yarn audit' with options
/// </summary>
/// <param name="auditSettings">options when running 'yarn audit'</param>
/// <returns></returns>
IYarnRunnerCommands Audit(Action<YarnAuditSettings> auditSettings = null);

/// <summary>
/// execute 'yarn publish' with options
/// </summary>
/// <param name="publishSettings">options when running 'yarn publish'</param>
/// <returns></returns>
IYarnRunnerCommands Publish(Action<YarnPublishSettings> publishSettings = null);
}
}
9 changes: 9 additions & 0 deletions src/Cake.Yarn/YarnPublishSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ public YarnPublishSettings NewVersion(int major, int minor, int patch)
return this;
}

/// <summary>Applies the --new-version parameter.</summary>
/// <param name="version">The version</param>
/// <returns></returns>
public YarnPublishSettings NewVersion(string version)
{
_newVersion = version;
return this;
}

/// <summary>
/// Applies the --tag parameter
/// </summary>
Expand Down