Skip to content

Commit

Permalink
Merge branch 'hotfix/0.9.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiringWorm committed Jul 11, 2020
2 parents e19568e + fafc5c9 commit ed3cf9f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Source/Cake.Codecov.Tests/CodecovAliasesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void Should_Use_Specified_Files()

var result = fixture.Run();

result.Args.Should().Contain($"--file \"{string.Join(" ", files)}\"");
result.Args.Should().Contain($"--file \"{string.Join("\" \"", files)}\"");
}

[Fact]
Expand All @@ -78,7 +78,7 @@ public void Should_Use_Specified_Files_And_Token()
result.Args.Should()
.ContainAll(new[]
{
$"--file \"{string.Join(" ", files)}\"",
$"--file \"{string.Join("\" \"", files)}\"",
$"--token \"{token}\""
});
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Cake.Codecov.Tests/CodecovRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public void Should_Set_Envs()
var result = fixture.Run();

// Then
result.Args.Should().Be(@"--env ""env1 env2""");
result.Args.Should().Be(@"--env ""env1"" ""env2""");
}

[Fact]
Expand All @@ -291,7 +291,7 @@ public void Should_Set_Files()
var result = fixture.Run();

// Then
result.Args.Should().Be(@"--file ""file1.xml file2.xml""");
result.Args.Should().Be(@"--file ""file1.xml"" ""file2.xml""");
}

[Fact]
Expand Down
28 changes: 23 additions & 5 deletions Source/Cake.Codecov/CodecovRunner.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;

using Cake.Codecov.Internals;
using Cake.Core;
Expand Down Expand Up @@ -57,8 +58,11 @@ protected override IEnumerable<string> GetToolExecutableNames()

private static void AddValue(ProcessArgumentBuilder builder, string key, IEnumerable<string> value)
{
var joinedValue = string.Join(" ", value);
AddValue(builder, key, joinedValue);
AddValue(builder, key, value.FirstOrDefault());
foreach (var subValue in value.Skip(1))
{
AddValue(builder, key, subValue, true);
}
}

private static void AddValue(ProcessArgumentBuilder builder, string key, Uri value)
Expand All @@ -77,15 +81,29 @@ private static void AddValue(ProcessArgumentBuilder builder, KeyValuePair<string
}
}

private static void AddValue(ProcessArgumentBuilder builder, string key, string value)
private static void AddValue(ProcessArgumentBuilder builder, string key, string value, bool onlyAppendValue = false)
{
if (key.StartsWith("!", StringComparison.OrdinalIgnoreCase))
{
builder.AppendSwitchQuotedSecret(key.TrimStart('!'), " ", value);
if (onlyAppendValue)
{
builder.AppendQuoted(value);
}
else
{
builder.AppendSwitchQuotedSecret(key.TrimStart('!'), " ", value);
}
}
else
{
builder.AppendSwitchQuoted(key, " ", value);
if (onlyAppendValue)
{
builder.AppendQuoted(value);
}
else
{
builder.AppendSwitchQuoted(key, " ", value);
}
}
}

Expand Down

0 comments on commit ed3cf9f

Please sign in to comment.