-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
123 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Shouldly; | ||
using Xunit; | ||
|
||
namespace Cake.Npm.Tests | ||
{ | ||
public class NpmPackTests | ||
{ | ||
private readonly NpmPackFixture _fixture; | ||
public NpmPackTests() | ||
{ | ||
_fixture = new NpmPackFixture(); | ||
} | ||
|
||
[Fact] | ||
public void Not_Setting_Target_Should_Use_Empty() | ||
{ | ||
var result = _fixture.Run(); | ||
result.Args.ShouldBe("pack"); | ||
} | ||
|
||
[Fact] | ||
public void Including_Target_Should_Set_Correct_Argument() | ||
{ | ||
_fixture.Target = "package.tgz"; | ||
var result = _fixture.Run(); | ||
result.Args.ShouldBe("pack package.tgz"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using Cake.Core; | ||
using Cake.Core.IO; | ||
|
||
namespace Cake.Npm | ||
{ | ||
/// <summary> | ||
/// npm pack options | ||
/// </summary> | ||
public class NpmPackSettings : NpmRunnerSettings | ||
{ | ||
/// <summary> | ||
/// 'npm pack' settings with target | ||
/// </summary> | ||
public NpmPackSettings(string target) : base("pack") | ||
{ | ||
Target = target; | ||
} | ||
|
||
/// <summary> | ||
/// 'npm pack' settings | ||
/// </summary> | ||
public NpmPackSettings() : this(null) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Installation target | ||
/// </summary> | ||
public string Target { get; set; } | ||
|
||
/// <summary> | ||
/// evaluate options | ||
/// </summary> | ||
/// <param name="args"></param> | ||
protected override void EvaluateCore(ProcessArgumentBuilder args) | ||
{ | ||
base.EvaluateCore(args); | ||
if (!string.IsNullOrWhiteSpace(Target)) | ||
{ | ||
args.Append(Target); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters