Skip to content

Commit 55d0664

Browse files
committed
Added IOutputGenerator, simplified the names for other converters
1 parent d00e616 commit 55d0664

34 files changed

+163
-121
lines changed

src/GitVersionCore.Tests/GitVersionCore.Tests.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@
3838
<Content Include="VersionConverters\Approved\cs\AssemblyInfoFileUpdaterTests.ShouldCreateAssemblyInfoFileWhenNotExistsAndEnsureAssemblyInfo.approved.txt" />
3939
<Content Include="VersionConverters\Approved\cs\AssemblyInfoFileUpdaterTests.ShouldNotAddAssemblyInformationalVersionWhenVersionSchemeIsNone.approved.txt" />
4040
<Content Include="VersionConverters\Approved\cs\AssemblyInfoFileUpdaterTests.ShouldNotReplaceAssemblyVersionWhenVersionSchemeIsNone.approved.txt" />
41-
<Content Include="VersionConverters\Approved\cs\GitVersionInformationGeneratorTests.ShouldCreateFile.approved.txt" />
41+
<Content Include="VersionConverters\Approved\cs\GitVersionInfoGeneratorTests.ShouldCreateFile.approved.txt" />
4242
<Content Include="VersionConverters\Approved\fs\AssemblyInfoFileUpdaterTests.Issue1183ShouldAddFSharpAssemblyInformationalVersionBesideOtherAttributes.approved.txt" />
4343
<Content Include="VersionConverters\Approved\fs\AssemblyInfoFileUpdaterTests.ShouldAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFile.approved.txt" />
4444
<Content Include="VersionConverters\Approved\fs\AssemblyInfoFileUpdaterTests.ShouldCreateAssemblyInfoFileAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt" />
4545
<Content Include="VersionConverters\Approved\fs\AssemblyInfoFileUpdaterTests.ShouldCreateAssemblyInfoFilesAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt" />
4646
<Content Include="VersionConverters\Approved\fs\AssemblyInfoFileUpdaterTests.ShouldCreateAssemblyInfoFileWhenNotExistsAndEnsureAssemblyInfo.approved.txt" />
4747
<Content Include="VersionConverters\Approved\fs\AssemblyInfoFileUpdaterTests.ShouldNotAddAssemblyInformationalVersionWhenVersionSchemeIsNone.approved.txt" />
4848
<Content Include="VersionConverters\Approved\fs\AssemblyInfoFileUpdaterTests.ShouldNotReplaceAssemblyVersionWhenVersionSchemeIsNone.approved.txt" />
49-
<Content Include="VersionConverters\Approved\fs\GitVersionInformationGeneratorTests.ShouldCreateFile.approved.txt" />
49+
<Content Include="VersionConverters\Approved\fs\GitVersionInfoGeneratorTests.ShouldCreateFile.approved.txt" />
5050
<Content Include="VersionConverters\Approved\vb\AssemblyInfoFileUpdaterTests.Issue1183ShouldAddFSharpAssemblyInformationalVersionBesideOtherAttributes.approved.txt" />
5151
<Content Include="VersionConverters\Approved\vb\AssemblyInfoFileUpdaterTests.ShouldAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFile.approved.txt" />
5252
<Content Include="VersionConverters\Approved\vb\AssemblyInfoFileUpdaterTests.ShouldCreateAssemblyInfoFileAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt" />
5353
<Content Include="VersionConverters\Approved\vb\AssemblyInfoFileUpdaterTests.ShouldCreateAssemblyInfoFilesAtPathWhenNotExistsAndEnsureAssemblyInfo.approved.txt" />
5454
<Content Include="VersionConverters\Approved\vb\AssemblyInfoFileUpdaterTests.ShouldCreateAssemblyInfoFileWhenNotExistsAndEnsureAssemblyInfo.approved.txt" />
5555
<Content Include="VersionConverters\Approved\vb\AssemblyInfoFileUpdaterTests.ShouldNotAddAssemblyInformationalVersionWhenVersionSchemeIsNone.approved.txt" />
5656
<Content Include="VersionConverters\Approved\vb\AssemblyInfoFileUpdaterTests.ShouldNotReplaceAssemblyVersionWhenVersionSchemeIsNone.approved.txt" />
57-
<Content Include="VersionConverters\Approved\vb\GitVersionInformationGeneratorTests.ShouldCreateFile.approved.txt" />
57+
<Content Include="VersionConverters\Approved\vb\GitVersionInfoGeneratorTests.ShouldCreateFile.approved.txt" />
5858
<Content Include="VersionConverters\Approved\WixFileTests.UpdateWixVersionFile.approved.txt" />
5959
</ItemGroup>
6060
<ItemGroup>

src/GitVersionCore.Tests/VersionConverters/AssemblyInfoFileUpdaterTests.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using GitVersion.Logging;
88
using GitVersion.OutputVariables;
99
using GitVersion.VersionCalculation;
10-
using GitVersion.VersionConverters.VersionAssemblyInfoResources;
10+
using GitVersion.VersionConverters.AssemblyInfo;
1111
using GitVersionCore.Tests.Helpers;
1212
using Microsoft.Extensions.DependencyInjection;
1313
using NSubstitute;
@@ -49,7 +49,7 @@ public void ShouldCreateAssemblyInfoFileWhenNotExistsAndEnsureAssemblyInfo(strin
4949
var variables = variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v"), new TestEffectiveConfiguration(), false);
5050

5151
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fileSystem);
52-
assemblyInfoFileUpdater.Update(variables, true, workingDir, assemblyInfoFile);
52+
assemblyInfoFileUpdater.Execute(variables, true, workingDir, assemblyInfoFile);
5353

5454
fileSystem.ReadAllText(fullPath).ShouldMatchApproved(c => c.SubFolder(Path.Combine("Approved", fileExtension)));
5555
}
@@ -67,7 +67,7 @@ public void ShouldCreateAssemblyInfoFileAtPathWhenNotExistsAndEnsureAssemblyInfo
6767
var variables = variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v"), new TestEffectiveConfiguration(), false);
6868

6969
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fileSystem);
70-
assemblyInfoFileUpdater.Update(variables, true, workingDir, assemblyInfoFile);
70+
assemblyInfoFileUpdater.Execute(variables, true, workingDir, assemblyInfoFile);
7171

7272
fileSystem.ReadAllText(fullPath).ShouldMatchApproved(c => c.SubFolder(Path.Combine("Approved", fileExtension)));
7373
}
@@ -88,7 +88,7 @@ public void ShouldCreateAssemblyInfoFilesAtPathWhenNotExistsAndEnsureAssemblyInf
8888
var variables = variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v"), new TestEffectiveConfiguration(), false);
8989

9090
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fileSystem);
91-
assemblyInfoFileUpdater.Update(variables, true, workingDir, assemblyInfoFiles.ToArray());
91+
assemblyInfoFileUpdater.Execute(variables, true, workingDir, assemblyInfoFiles.ToArray());
9292

9393
foreach (var item in assemblyInfoFiles)
9494
{
@@ -108,7 +108,7 @@ public void ShouldNotCreateAssemblyInfoFileWhenNotExistsAndNotEnsureAssemblyInfo
108108
var variables = variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v"), new TestEffectiveConfiguration(), false);
109109

110110
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fileSystem);
111-
assemblyInfoFileUpdater.Update(variables, false, workingDir, assemblyInfoFile);
111+
assemblyInfoFileUpdater.Execute(variables, false, workingDir, assemblyInfoFile);
112112

113113
fileSystem.Exists(fullPath).ShouldBeFalse();
114114
}
@@ -123,7 +123,7 @@ public void ShouldNotCreateAssemblyInfoFileForUnknownSourceCodeAndEnsureAssembly
123123
var variables = variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v"), new TestEffectiveConfiguration(), false);
124124

125125
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fileSystem);
126-
assemblyInfoFileUpdater.Update(variables, true, workingDir, assemblyInfoFile);
126+
assemblyInfoFileUpdater.Execute(variables, true, workingDir, assemblyInfoFile);
127127

128128
fileSystem.Received(0).WriteAllText(fullPath, Arg.Any<string>());
129129
}
@@ -137,7 +137,7 @@ public void ShouldStartSearchFromWorkingDirectory()
137137
var variables = variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v"), new TestEffectiveConfiguration(), false);
138138

139139
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fileSystem);
140-
assemblyInfoFileUpdater.Update(variables, false, workingDir, assemblyInfoFiles.ToArray());
140+
assemblyInfoFileUpdater.Execute(variables, false, workingDir, assemblyInfoFiles.ToArray());
141141

142142
fileSystem.Received().DirectoryGetFiles(Arg.Is(workingDir), Arg.Any<string>(), Arg.Any<SearchOption>());
143143
}
@@ -154,7 +154,7 @@ public void ShouldReplaceAssemblyVersion(string fileExtension, string assemblyFi
154154
VerifyAssemblyInfoFile(assemblyFileContent, fileName, AssemblyVersioningScheme.MajorMinor, (fs, variables) =>
155155
{
156156
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fs);
157-
assemblyInfoFileUpdater.Update(variables, false, workingDir, assemblyInfoFile);
157+
assemblyInfoFileUpdater.Execute(variables, false, workingDir, assemblyInfoFile);
158158

159159
fs.Received().WriteAllText(fileName, Arg.Is<string>(s =>
160160
s.Contains(@"AssemblyVersion(""2.3.0.0"")") &&
@@ -177,7 +177,7 @@ public void ShouldNotReplaceAssemblyVersionWhenVersionSchemeIsNone(string fileEx
177177
VerifyAssemblyInfoFile(assemblyFileContent, fileName, AssemblyVersioningScheme.None, verify: (fs, variables) =>
178178
{
179179
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fs);
180-
assemblyInfoFileUpdater.Update(variables, false, workingDir, assemblyInfoFile);
180+
assemblyInfoFileUpdater.Execute(variables, false, workingDir, assemblyInfoFile);
181181

182182
assemblyFileContent = fs.ReadAllText(fileName);
183183
assemblyFileContent.ShouldMatchApproved(c => c.SubFolder(Path.Combine("Approved", fileExtension)));
@@ -196,7 +196,7 @@ public void ShouldReplaceAssemblyVersionInRelativePath(string fileExtension, str
196196
VerifyAssemblyInfoFile(assemblyFileContent, fileName, AssemblyVersioningScheme.MajorMinor, (fs, variables) =>
197197
{
198198
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fs);
199-
assemblyInfoFileUpdater.Update(variables, false, workingDir, assemblyInfoFile);
199+
assemblyInfoFileUpdater.Execute(variables, false, workingDir, assemblyInfoFile);
200200

201201
fs.Received().WriteAllText(fileName, Arg.Is<string>(s =>
202202
s.Contains(@"AssemblyVersion(""2.3.0.0"")") &&
@@ -217,7 +217,7 @@ public void ShouldReplaceAssemblyVersionInRelativePathWithWhiteSpace(string file
217217
VerifyAssemblyInfoFile(assemblyFileContent, fileName, AssemblyVersioningScheme.MajorMinor, (fs, variables) =>
218218
{
219219
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fs);
220-
assemblyInfoFileUpdater.Update(variables, false, workingDir, assemblyInfoFile);
220+
assemblyInfoFileUpdater.Execute(variables, false, workingDir, assemblyInfoFile);
221221

222222
fs.Received().WriteAllText(fileName, Arg.Is<string>(s =>
223223
s.Contains(@"AssemblyVersion(""2.3.0.0"")") &&
@@ -238,7 +238,7 @@ public void ShouldReplaceAssemblyVersionWithStar(string fileExtension, string as
238238
VerifyAssemblyInfoFile(assemblyFileContent, fileName, AssemblyVersioningScheme.MajorMinor, (fs, variables) =>
239239
{
240240
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fs);
241-
assemblyInfoFileUpdater.Update(variables, false, workingDir, assemblyInfoFile);
241+
assemblyInfoFileUpdater.Execute(variables, false, workingDir, assemblyInfoFile);
242242

243243
fs.Received().WriteAllText(fileName, Arg.Is<string>(s =>
244244
s.Contains(@"AssemblyVersion(""2.3.0.0"")") &&
@@ -259,7 +259,7 @@ public void ShouldReplaceAssemblyVersionWithAtttributeSuffix(string fileExtensio
259259
VerifyAssemblyInfoFile(assemblyFileContent, fileName, verify: (fs, variables) =>
260260
{
261261
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fs);
262-
assemblyInfoFileUpdater.Update(variables, false, workingDir, assemblyInfoFile);
262+
assemblyInfoFileUpdater.Execute(variables, false, workingDir, assemblyInfoFile);
263263

264264
fs.Received().WriteAllText(fileName, Arg.Is<string>(s =>
265265
!s.Contains(@"AssemblyVersionAttribute(""1.0.0.0"")") &&
@@ -283,7 +283,7 @@ public void ShouldAddAssemblyVersionIfMissingFromInfoFile(string fileExtension)
283283
VerifyAssemblyInfoFile("", fileName, AssemblyVersioningScheme.MajorMinor, (fs, variables) =>
284284
{
285285
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fs);
286-
assemblyInfoFileUpdater.Update(variables, false, workingDir, assemblyInfoFile);
286+
assemblyInfoFileUpdater.Execute(variables, false, workingDir, assemblyInfoFile);
287287

288288
fs.Received().WriteAllText(fileName, Arg.Is<string>(s =>
289289
s.Contains(@"AssemblyVersion(""2.3.0.0"")") &&
@@ -304,7 +304,7 @@ public void ShouldReplaceAlreadySubstitutedValues(string fileExtension, string a
304304
VerifyAssemblyInfoFile(assemblyFileContent, fileName, AssemblyVersioningScheme.MajorMinor, (fs, variables) =>
305305
{
306306
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fs);
307-
assemblyInfoFileUpdater.Update(variables, false, workingDir, assemblyInfoFile);
307+
assemblyInfoFileUpdater.Execute(variables, false, workingDir, assemblyInfoFile);
308308

309309
fs.Received().WriteAllText(fileName, Arg.Is<string>(s =>
310310
s.Contains(@"AssemblyVersion(""2.3.0.0"")") &&
@@ -325,7 +325,7 @@ public void ShouldReplaceAssemblyVersionWhenCreatingAssemblyVersionFileAndEnsure
325325
VerifyAssemblyInfoFile(assemblyFileContent, fileName, verify: (fs, variables) =>
326326
{
327327
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fs);
328-
assemblyInfoFileUpdater.Update(variables, false, workingDir, assemblyInfoFile);
328+
assemblyInfoFileUpdater.Execute(variables, false, workingDir, assemblyInfoFile);
329329

330330
fs.Received().WriteAllText(fileName, Arg.Is<string>(s =>
331331
s.Contains(@"AssemblyVersion(""2.3.1.0"")") &&
@@ -346,7 +346,7 @@ public void ShouldReplaceAssemblyVersionInRelativePathWithVariables(string fileE
346346
VerifyAssemblyInfoFile(assemblyFileContent, fileName, AssemblyVersioningScheme.MajorMinor, (fs, variables) =>
347347
{
348348
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fs);
349-
assemblyInfoFileUpdater.Update(variables, false, workingDir, assemblyInfoFile);
349+
assemblyInfoFileUpdater.Execute(variables, false, workingDir, assemblyInfoFile);
350350

351351
fs.Received().WriteAllText(fileName, Arg.Is<string>(s =>
352352
s.Contains(@"AssemblyVersion(""2.3.0.0"")") &&
@@ -367,7 +367,7 @@ public void ShouldReplaceAssemblyVersionInRelativePathWithVariablesAndWhiteSpace
367367
VerifyAssemblyInfoFile(assemblyFileContent, fileName, AssemblyVersioningScheme.MajorMinor, (fs, variables) =>
368368
{
369369
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fs);
370-
assemblyInfoFileUpdater.Update(variables, false, workingDir, assemblyInfoFile);
370+
assemblyInfoFileUpdater.Execute(variables, false, workingDir, assemblyInfoFile);
371371

372372
fs.Received().WriteAllText(fileName, Arg.Is<string>(s =>
373373
s.Contains(@"AssemblyVersion(""2.3.0.0"")") &&
@@ -390,7 +390,7 @@ public void ShouldAddAssemblyInformationalVersionWhenUpdatingAssemblyVersionFile
390390
VerifyAssemblyInfoFile(assemblyFileContent, fileName, verify: (fs, variables) =>
391391
{
392392
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fs);
393-
assemblyInfoFileUpdater.Update(variables, false, workingDir, assemblyInfoFile);
393+
assemblyInfoFileUpdater.Execute(variables, false, workingDir, assemblyInfoFile);
394394

395395
assemblyFileContent = fs.ReadAllText(fileName);
396396
assemblyFileContent.ShouldMatchApproved(c => c.SubFolder(Path.Combine("Approved", fileExtension)));
@@ -411,7 +411,7 @@ public void Issue1183ShouldAddFSharpAssemblyInformationalVersionBesideOtherAttri
411411
VerifyAssemblyInfoFile(assemblyFileContent, fileName, verify: (fs, variables) =>
412412
{
413413
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fs);
414-
assemblyInfoFileUpdater.Update(variables, false, workingDir, assemblyInfoFile);
414+
assemblyInfoFileUpdater.Execute(variables, false, workingDir, assemblyInfoFile);
415415

416416
assemblyFileContent = fs.ReadAllText(fileName);
417417
assemblyFileContent.ShouldMatchApproved(c => c.SubFolder(Path.Combine("Approved", fileExtension)));
@@ -432,7 +432,7 @@ public void ShouldNotAddAssemblyInformationalVersionWhenVersionSchemeIsNone(stri
432432
VerifyAssemblyInfoFile(assemblyFileContent, fileName, AssemblyVersioningScheme.None, verify: (fs, variables) =>
433433
{
434434
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(log, fs);
435-
assemblyInfoFileUpdater.Update(variables, false, workingDir, assemblyInfoFile);
435+
assemblyInfoFileUpdater.Execute(variables, false, workingDir, assemblyInfoFile);
436436

437437
assemblyFileContent = fs.ReadAllText(fileName);
438438
assemblyFileContent.ShouldMatchApproved(c => c.SubFolder(Path.Combine("Approved", fileExtension)));

src/GitVersionCore.Tests/VersionConverters/GitVersionInformationGeneratorTests.cs renamed to src/GitVersionCore.Tests/VersionConverters/GitVersionInfoGeneratorTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.IO;
33
using GitVersion;
44
using GitVersion.VersionCalculation;
5-
using GitVersion.VersionConverters.GitVersionInformationResources;
5+
using GitVersion.VersionConverters.GitVersionInfo;
66
using GitVersionCore.Tests.Helpers;
77
using Microsoft.Extensions.DependencyInjection;
88
using NUnit.Framework;
@@ -12,7 +12,7 @@ namespace GitVersionCore.Tests
1212
{
1313
[TestFixture]
1414
[Parallelizable(ParallelScope.None)]
15-
public class GitVersionInformationGeneratorTests : TestBase
15+
public class GitVersionInfoGeneratorTests : TestBase
1616
{
1717
[SetUp]
1818
public void Setup()
@@ -47,9 +47,9 @@ public void ShouldCreateFile(string fileExtension)
4747
var variableProvider = sp.GetService<IVariableProvider>();
4848

4949
var variables = variableProvider.GetVariablesFor(semanticVersion, new TestEffectiveConfiguration(), false);
50-
var generator = new GitVersionInformationGenerator(fileSystem);
50+
using var generator = new GitVersionInfoGenerator(fileSystem);
5151

52-
generator.Generate(variables, new FileWriteInfo(directory, fileName, fileExtension));
52+
generator.Execute(variables, new FileWriteInfo(directory, fileName, fileExtension));
5353

5454
fileSystem.ReadAllText(fullPath).ShouldMatchApproved(c => c.SubFolder(Path.Combine("Approved", fileExtension)));
5555
}

src/GitVersionCore.Tests/VersionConverters/WixFileTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void UpdateWixVersionFile()
6060

6161
using var wixVersionFileUpdater = sp.GetService<IWixVersionFileUpdater>();
6262

63-
var file = wixVersionFileUpdater.Update(versionVariables, workingDir);
63+
var file = wixVersionFileUpdater.Execute(versionVariables, workingDir);
6464
fileSystem
6565
.ReadAllText(file)
6666
.ShouldMatchApproved(c => c.SubFolder(Path.Combine("Approved")));

0 commit comments

Comments
 (0)