Skip to content

Commit

Permalink
Replace the command line argument switches for GitVersion
Browse files Browse the repository at this point in the history
Replace slash with dash in the command line argument switches for gitversion.exe, so it is more Unix friendly. It will still fail exeucting on OS X due to GitTools/GitVersion#890, but once that has been fixed, this should ensure that GitVersion executes successfully on OS X.
  • Loading branch information
asbjornu committed Jun 30, 2016
1 parent ff508d3 commit 4b0b47b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void Should_Add_OutputType_To_Arguments_If_Set()
var result = fixture.Run();

// Then
Assert.Equal("/output json", result.Args);
Assert.Equal("-output json", result.Args);
}

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

// Then
Assert.Equal("/showvariable FullSemVer", result.Args);
Assert.Equal("-showvariable FullSemVer", result.Args);
}

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

// Then
Assert.Equal("/u \"bob\" /p \"password\"", result.Args);
Assert.Equal("-u \"bob\" -p \"password\"", result.Args);
}

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

// Then
Assert.Equal("/updateassemblyinfo", result.Args);
Assert.Equal("-updateassemblyinfo", result.Args);
}

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

// Then
Assert.Equal("/updateassemblyinfo \"c:/temp/assemblyinfo.cs\"", result.Args);
Assert.Equal("-updateassemblyinfo \"c:/temp/assemblyinfo.cs\"", result.Args);
}

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

// Then
Assert.Equal("/targetpath \"c:/temp\"", result.Args);
Assert.Equal("-targetpath \"c:/temp\"", result.Args);
}

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

// Then
Assert.Equal("/url \"http://mygitrepo.co.uk\" /b master /c \"abcdef\" /dynamicRepoLocation \"c:/temp\"", result.Args);
Assert.Equal("-url \"http://mygitrepo.co.uk\" -b master -c \"abcdef\" -dynamicRepoLocation \"c:/temp\"", result.Args);
}

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

// Then
Assert.Equal("/l \"c:/temp/gitversion.log\"", result.Args);
Assert.Equal("-l \"c:/temp/gitversion.log\"", result.Args);
}
}
}
Expand Down
24 changes: 12 additions & 12 deletions src/Cake.Common/Tools/GitVersion/GitVersionRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,34 +79,34 @@ private ProcessArgumentBuilder GetArguments(GitVersionSettings settings)
switch (settings.OutputType.Value)
{
case GitVersionOutput.Json:
builder.Append("/output");
builder.Append("-output");
builder.Append("json");
break;
case GitVersionOutput.BuildServer:
builder.Append("/output");
builder.Append("-output");
builder.Append("buildserver");
break;
}
}

if (!string.IsNullOrWhiteSpace(settings.ShowVariable))
{
builder.Append("/showvariable");
builder.Append("-showvariable");
builder.Append(settings.ShowVariable);
}

if (!string.IsNullOrWhiteSpace(settings.UserName))
{
builder.Append("/u");
builder.Append("-u");
builder.AppendQuoted(settings.UserName);

builder.Append("/p");
builder.Append("-p");
builder.AppendQuotedSecret(settings.Password);
}

if (settings.UpdateAssemblyInfo)
{
builder.Append("/updateassemblyinfo");
builder.Append("-updateassemblyinfo");

if (settings.UpdateAssemblyInfoFilePath != null)
{
Expand All @@ -116,17 +116,17 @@ private ProcessArgumentBuilder GetArguments(GitVersionSettings settings)

if (settings.RepositoryPath != null)
{
builder.Append("/targetpath");
builder.Append("-targetpath");
builder.AppendQuoted(settings.RepositoryPath.FullPath);
}
else if (!string.IsNullOrWhiteSpace(settings.Url))
{
builder.Append("/url");
builder.Append("-url");
builder.AppendQuoted(settings.Url);

if (!string.IsNullOrWhiteSpace(settings.Branch))
{
builder.Append("/b");
builder.Append("-b");
builder.Append(settings.Branch);
}
else
Expand All @@ -136,20 +136,20 @@ private ProcessArgumentBuilder GetArguments(GitVersionSettings settings)

if (!string.IsNullOrWhiteSpace(settings.Commit))
{
builder.Append("/c");
builder.Append("-c");
builder.AppendQuoted(settings.Commit);
}

if (settings.DynamicRepositoryPath != null)
{
builder.Append("/dynamicRepoLocation");
builder.Append("-dynamicRepoLocation");
builder.AppendQuoted(settings.DynamicRepositoryPath.FullPath);
}
}

if (settings.LogFilePath != null)
{
builder.Append("/l");
builder.Append("-l");
builder.AppendQuoted(settings.LogFilePath.FullPath);
}

Expand Down

0 comments on commit 4b0b47b

Please sign in to comment.