Skip to content

Commit eb131da

Browse files
committed
applied code review changes
1 parent fdad726 commit eb131da

14 files changed

+59
-59
lines changed

src/GitVersionCore.Tests/DynamicRepositoryTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ public void FindsVersionInDynamicRepo(string name, string url, string targetBran
8080
var log = new NullLog();
8181
var configFileLocator = new DefaultConfigFileLocator(testFileSystem, log);
8282

83-
var executeCore = new ExecuteCore(testFileSystem, log, configFileLocator, new BuildServerResolver(null, log));
83+
var executeCore = new GitVersionComputer(testFileSystem, log, configFileLocator, new BuildServerResolver(null, log));
8484

85-
var versionVariables = executeCore.ExecuteGitVersion(arguments);
85+
var versionVariables = executeCore.ComputeVersionVariables(arguments);
8686

8787
Assert.AreEqual(expectedFullSemVer, versionVariables.FullSemVer);
8888
}

src/GitVersionCore.Tests/ExecuteCoreTests.cs renamed to src/GitVersionCore.Tests/GitVersionExecutorTests.cs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace GitVersionCore.Tests
1919
{
2020
[TestFixture]
2121
[Parallelizable(ParallelScope.None)]
22-
public class ExecuteCoreTests : TestBase
22+
public class GitVersionExecutorTests : TestBase
2323
{
2424
private IFileSystem fileSystem;
2525
private IEnvironment environment;
@@ -40,7 +40,7 @@ public void SetUp()
4040
[Test]
4141
public void CacheKeySameAfterReNormalizing()
4242
{
43-
var versionAndBranchFinder = new ExecuteCore(fileSystem, log, configFileLocator, buildServerResolver);
43+
var versionAndBranchFinder = new GitVersionComputer(fileSystem, log, configFileLocator, buildServerResolver);
4444

4545
RepositoryScope(versionAndBranchFinder, (fixture, vv) =>
4646
{
@@ -62,7 +62,7 @@ public void CacheKeySameAfterReNormalizing()
6262
[Description("LibGit2Sharp fails here when running under Mono")]
6363
public void CacheKeyForWorktree()
6464
{
65-
var versionAndBranchFinder = new ExecuteCore(fileSystem, log, configFileLocator, buildServerResolver);
65+
var versionAndBranchFinder = new GitVersionComputer(fileSystem, log, configFileLocator, buildServerResolver);
6666

6767
RepositoryScope(versionAndBranchFinder, (fixture, vv) =>
6868
{
@@ -128,12 +128,12 @@ public void CacheFileExistsOnDisk()
128128
var logAppender = new TestLogAppender(Action);
129129
log = new Log(logAppender);
130130

131-
var versionAndBranchFinder = new ExecuteCore(fileSystem, log, configFileLocator, buildServerResolver);
131+
var versionAndBranchFinder = new GitVersionComputer(fileSystem, log, configFileLocator, buildServerResolver);
132132

133133
RepositoryScope(versionAndBranchFinder, (fixture, vv) =>
134134
{
135135
fileSystem.WriteAllText(vv.FileName, versionCacheFileContent);
136-
vv = versionAndBranchFinder.ExecuteGitVersion(new Arguments { TargetPath = fixture.RepositoryPath });
136+
vv = versionAndBranchFinder.ComputeVersionVariables(new Arguments { TargetPath = fixture.RepositoryPath });
137137
vv.AssemblySemVer.ShouldBe("4.10.3.0");
138138
});
139139

@@ -177,7 +177,7 @@ public void CacheFileExistsOnDiskWhenOverrideConfigIsSpecifiedVersionShouldBeDyn
177177
CommitDate: 2015-11-10
178178
";
179179

180-
var versionAndBranchFinder = new ExecuteCore(fileSystem, log, configFileLocator, buildServerResolver);
180+
var versionAndBranchFinder = new GitVersionComputer(fileSystem, log, configFileLocator, buildServerResolver);
181181

182182
RepositoryScope(versionAndBranchFinder, (fixture, vv) =>
183183
{
@@ -188,7 +188,7 @@ public void CacheFileExistsOnDiskWhenOverrideConfigIsSpecifiedVersionShouldBeDyn
188188

189189
var cacheDirectoryTimestamp = fileSystem.GetLastDirectoryWrite(cacheDirectory);
190190

191-
vv = versionAndBranchFinder.ExecuteGitVersion(new Arguments { TargetPath = fixture.RepositoryPath , OverrideConfig = new Config { TagPrefix = "prefix" } });
191+
vv = versionAndBranchFinder.ComputeVersionVariables(new Arguments { TargetPath = fixture.RepositoryPath , OverrideConfig = new Config { TagPrefix = "prefix" } });
192192

193193
vv.AssemblySemVer.ShouldBe("0.1.0.0");
194194

@@ -208,7 +208,7 @@ public void CacheFileIsMissing()
208208
var logAppender = new TestLogAppender(Action);
209209
log = new Log(logAppender);
210210

211-
var executeCore = new ExecuteCore(fileSystem, log, configFileLocator, buildServerResolver);
211+
var executeCore = new GitVersionComputer(fileSystem, log, configFileLocator, buildServerResolver);
212212

213213
RepositoryScope(executeCore);
214214
var logsMessages = stringBuilder.ToString();
@@ -252,19 +252,19 @@ public void ConfigChangeInvalidatesCache()
252252
CommitDate: 2015-11-10
253253
";
254254

255-
var versionAndBranchFinder = new ExecuteCore(fileSystem, log, configFileLocator, buildServerResolver);
255+
var versionAndBranchFinder = new GitVersionComputer(fileSystem, log, configFileLocator, buildServerResolver);
256256

257257
RepositoryScope(versionAndBranchFinder, (fixture, vv) =>
258258
{
259259
fileSystem.WriteAllText(vv.FileName, versionCacheFileContent);
260260
var arguments = new Arguments { TargetPath = fixture.RepositoryPath };
261-
vv = versionAndBranchFinder.ExecuteGitVersion(arguments);
261+
vv = versionAndBranchFinder.ComputeVersionVariables(arguments);
262262
vv.AssemblySemVer.ShouldBe("4.10.3.0");
263263

264264
var configPath = Path.Combine(fixture.RepositoryPath, "GitVersionConfig.yaml");
265265
fileSystem.WriteAllText(configPath, "next-version: 5.0");
266266

267-
vv = versionAndBranchFinder.ExecuteGitVersion(arguments);
267+
vv = versionAndBranchFinder.ComputeVersionVariables(arguments);
268268
vv.AssemblySemVer.ShouldBe("5.0.0.0");
269269
});
270270
}
@@ -305,18 +305,18 @@ public void NoCacheBypassesCache()
305305
CommitDate: 2015-11-10
306306
";
307307

308-
var versionAndBranchFinder = new ExecuteCore(fileSystem, log, configFileLocator, buildServerResolver);
308+
var versionAndBranchFinder = new GitVersionComputer(fileSystem, log, configFileLocator, buildServerResolver);
309309

310310
RepositoryScope(versionAndBranchFinder, (fixture, vv) =>
311311
{
312312
var arguments = new Arguments { TargetPath = fixture.RepositoryPath };
313313

314314
fileSystem.WriteAllText(vv.FileName, versionCacheFileContent);
315-
vv = versionAndBranchFinder.ExecuteGitVersion(arguments);
315+
vv = versionAndBranchFinder.ComputeVersionVariables(arguments);
316316
vv.AssemblySemVer.ShouldBe("4.10.3.0");
317317

318318
arguments.NoCache = true;
319-
vv = versionAndBranchFinder.ExecuteGitVersion(arguments);
319+
vv = versionAndBranchFinder.ComputeVersionVariables(arguments);
320320
vv.AssemblySemVer.ShouldBe("0.1.0.0");
321321
});
322322
}
@@ -325,13 +325,13 @@ public void NoCacheBypassesCache()
325325
[Test]
326326
public void WorkingDirectoryWithoutGit()
327327
{
328-
var versionAndBranchFinder = new ExecuteCore(fileSystem, log, configFileLocator, buildServerResolver);
328+
var versionAndBranchFinder = new GitVersionComputer(fileSystem, log, configFileLocator, buildServerResolver);
329329

330330
RepositoryScope(versionAndBranchFinder, (fixture, vv) =>
331331
{
332332
var arguments = new Arguments { TargetPath = Environment.SystemDirectory };
333333

334-
var exception = Assert.Throws<DirectoryNotFoundException>(() => versionAndBranchFinder.ExecuteGitVersion(arguments));
334+
var exception = Assert.Throws<DirectoryNotFoundException>(() => versionAndBranchFinder.ComputeVersionVariables(arguments));
335335
exception.Message.ShouldContain("Can't find the .git directory in");
336336
});
337337
}
@@ -341,7 +341,7 @@ public void WorkingDirectoryWithoutGit()
341341
[Description("LibGit2Sharp fails when running under Mono")]
342342
public void GetProjectRootDirectory_WorkingDirectoryWithWorktree()
343343
{
344-
var versionAndBranchFinder = new ExecuteCore(fileSystem, log, configFileLocator, buildServerResolver);
344+
var versionAndBranchFinder = new GitVersionComputer(fileSystem, log, configFileLocator, buildServerResolver);
345345

346346
RepositoryScope(versionAndBranchFinder, (fixture, vv) =>
347347
{
@@ -366,7 +366,7 @@ public void GetProjectRootDirectory_WorkingDirectoryWithWorktree()
366366
[Test]
367367
public void GetProjectRootDirectory_NoWorktree()
368368
{
369-
var versionAndBranchFinder = new ExecuteCore(fileSystem, log, configFileLocator, buildServerResolver);
369+
var versionAndBranchFinder = new GitVersionComputer(fileSystem, log, configFileLocator, buildServerResolver);
370370

371371
RepositoryScope(versionAndBranchFinder, (fixture, vv) =>
372372
{
@@ -380,7 +380,7 @@ public void GetProjectRootDirectory_NoWorktree()
380380
[Test]
381381
public void DynamicRepositoriesShouldNotErrorWithFailedToFindGitDirectory()
382382
{
383-
var versionAndBranchFinder = new ExecuteCore(fileSystem, log, configFileLocator, buildServerResolver);
383+
var versionAndBranchFinder = new GitVersionComputer(fileSystem, log, configFileLocator, buildServerResolver);
384384

385385
RepositoryScope(versionAndBranchFinder, (fixture, vv) =>
386386
{
@@ -391,14 +391,14 @@ public void DynamicRepositoriesShouldNotErrorWithFailedToFindGitDirectory()
391391
TargetBranch = "refs/head/master"
392392
};
393393

394-
versionAndBranchFinder.ExecuteGitVersion(arguments);
394+
versionAndBranchFinder.ComputeVersionVariables(arguments);
395395
});
396396
}
397397

398398
[Test]
399399
public void GetDotGitDirectory_NoWorktree()
400400
{
401-
var versionAndBranchFinder = new ExecuteCore(fileSystem, log, configFileLocator, buildServerResolver);
401+
var versionAndBranchFinder = new GitVersionComputer(fileSystem, log, configFileLocator, buildServerResolver);
402402

403403
RepositoryScope(versionAndBranchFinder, (fixture, vv) =>
404404
{
@@ -414,7 +414,7 @@ public void GetDotGitDirectory_NoWorktree()
414414
[Description("LibGit2Sharp fails when running under Mono")]
415415
public void GetDotGitDirectory_Worktree()
416416
{
417-
var versionAndBranchFinder = new ExecuteCore(fileSystem, log, configFileLocator, buildServerResolver);
417+
var versionAndBranchFinder = new GitVersionComputer(fileSystem, log, configFileLocator, buildServerResolver);
418418

419419
RepositoryScope(versionAndBranchFinder, (fixture, vv) =>
420420
{
@@ -438,7 +438,7 @@ public void GetDotGitDirectory_Worktree()
438438
});
439439
}
440440

441-
private void RepositoryScope(ExecuteCore executeCore, Action<EmptyRepositoryFixture, VersionVariables> fixtureAction = null)
441+
private void RepositoryScope(GitVersionComputer gitVersionComputer, Action<EmptyRepositoryFixture, VersionVariables> fixtureAction = null)
442442
{
443443
// Make sure GitVersion doesn't trigger build server mode when we are running the tests
444444
environment.SetEnvironmentVariable(AppVeyor.EnvironmentVariableName, null);
@@ -449,7 +449,7 @@ private void RepositoryScope(ExecuteCore executeCore, Action<EmptyRepositoryFixt
449449
using var fixture = new EmptyRepositoryFixture();
450450
var arguments = new Arguments { TargetPath = fixture.RepositoryPath };
451451
fixture.Repository.MakeACommit();
452-
var vv = executeCore.ExecuteGitVersion(arguments);
452+
var vv = gitVersionComputer.ComputeVersionVariables(arguments);
453453

454454
vv.AssemblySemVer.ShouldBe("0.1.0.0");
455455
vv.FileName.ShouldNotBeNullOrEmpty();

src/GitVersionCore/ExecuteCore.cs renamed to src/GitVersionCore/GitVersionComputer.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88

99
namespace GitVersion
1010
{
11-
public class ExecuteCore : IExecuteCore
11+
public class GitVersionComputer : IGitVersionComputer
1212
{
1313
private readonly IFileSystem fileSystem;
1414
private readonly ILog log;
1515
private readonly IConfigFileLocator configFileLocator;
1616
private readonly IBuildServerResolver buildServerResolver;
1717
private readonly GitVersionCache gitVersionCache;
1818

19-
public ExecuteCore(IFileSystem fileSystem, ILog log, IConfigFileLocator configFileLocator, IBuildServerResolver buildServerResolver)
19+
public GitVersionComputer(IFileSystem fileSystem, ILog log, IConfigFileLocator configFileLocator, IBuildServerResolver buildServerResolver)
2020
{
2121
this.fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
2222
this.log = log;
@@ -25,9 +25,9 @@ public ExecuteCore(IFileSystem fileSystem, ILog log, IConfigFileLocator configFi
2525
gitVersionCache = new GitVersionCache(fileSystem, log);
2626
}
2727

28-
public VersionVariables ExecuteGitVersion(Arguments arguments)
28+
public VersionVariables ComputeVersionVariables(Arguments arguments)
2929
{
30-
return ExecuteGitVersion(
30+
return ComputeVersionVariables(
3131
arguments.TargetUrl, arguments.DynamicRepositoryLocation, arguments.Authentication,
3232
arguments.TargetBranch, arguments.NoFetch, arguments.TargetPath,
3333
arguments.CommitId, arguments.OverrideConfig, arguments.NoCache, arguments.NoNormalize);
@@ -37,7 +37,7 @@ public bool TryGetVersion(string directory, out VersionVariables versionVariable
3737
{
3838
try
3939
{
40-
versionVariables = ExecuteGitVersion(null, null, null, null, noFetch, directory, null);
40+
versionVariables = ComputeVersionVariables(null, null, null, null, noFetch, directory, null);
4141
return true;
4242
}
4343
catch (Exception ex)
@@ -48,7 +48,7 @@ public bool TryGetVersion(string directory, out VersionVariables versionVariable
4848
}
4949
}
5050

51-
private VersionVariables ExecuteGitVersion(string targetUrl, string dynamicRepositoryLocation, Authentication authentication, string targetBranch, bool noFetch, string workingDirectory, string commitId, Config overrideConfig = null, bool noCache = false, bool noNormalize = false)
51+
private VersionVariables ComputeVersionVariables(string targetUrl, string dynamicRepositoryLocation, Authentication authentication, string targetBranch, bool noFetch, string workingDirectory, string commitId, Config overrideConfig = null, bool noCache = false, bool noNormalize = false)
5252
{
5353
// Normalize if we are running on build server
5454
var buildServer = buildServerResolver.GetCurrentBuildServer();

src/GitVersionCore/CoreModule.cs renamed to src/GitVersionCore/GitVersionModule.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010
namespace GitVersion
1111
{
12-
public class CoreModule : IModule
12+
public class GitVersionModule : IModule
1313
{
1414
public void RegisterTypes(IServiceCollection services)
1515
{
1616
services.AddSingleton<IFileSystem, FileSystem>();
1717
services.AddSingleton<IEnvironment, Environment>();
1818
services.AddSingleton<ILog, Log>();
1919

20-
services.AddSingleton<IExecuteCore, ExecuteCore>();
20+
services.AddSingleton<IGitVersionComputer, GitVersionComputer>();
2121

2222
services.AddSingleton<IBuildServerResolver, BuildServerResolver>();
2323
services.AddSingleton(GetConfigFileLocator);

src/GitVersionCore/IExecuteCore.cs renamed to src/GitVersionCore/IGitVersionComputer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace GitVersion
44
{
5-
public interface IExecuteCore
5+
public interface IGitVersionComputer
66
{
7-
VersionVariables ExecuteGitVersion(Arguments arguments);
7+
VersionVariables ComputeVersionVariables(Arguments arguments);
88
bool TryGetVersion(string directory, out VersionVariables versionVariables, bool noFetch);
99
}
1010
}

src/GitVersionExe/ExecCommand.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,24 @@ public class ExecCommand : IExecCommand
2121
private readonly IFileSystem fileSystem;
2222
private readonly IBuildServerResolver buildServerResolver;
2323
private readonly ILog log;
24-
private readonly IExecuteCore executeCore;
24+
private readonly IGitVersionComputer gitVersionComputer;
2525
private readonly Arguments arguments;
2626
public static readonly string BuildTool = GetMsBuildToolPath();
2727

28-
public ExecCommand(IFileSystem fileSystem, IBuildServerResolver buildServerResolver, ILog log, IExecuteCore executeCore, IOptions<Arguments> arguments)
28+
public ExecCommand(IFileSystem fileSystem, IBuildServerResolver buildServerResolver, ILog log, IGitVersionComputer gitVersionComputer, IOptions<Arguments> arguments)
2929
{
3030
this.fileSystem = fileSystem;
3131
this.buildServerResolver = buildServerResolver;
3232
this.log = log;
33-
this.executeCore = executeCore;
33+
this.gitVersionComputer = gitVersionComputer;
3434
this.arguments = arguments.Value;
3535
}
3636

37-
public void Execute()
37+
public void Compute()
3838
{
3939
log.Info($"Running on {(runningOnUnix ? "Unix" : "Windows")}.");
4040

41-
var variables = executeCore.ExecuteGitVersion(arguments);
41+
var variables = gitVersionComputer.ComputeVersionVariables(arguments);
4242

4343
switch (arguments.Output)
4444
{

src/GitVersionExe/GitVersionApp.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ namespace GitVersion
1010
internal class GitVersionApp : IHostedService
1111
{
1212
private readonly IHostApplicationLifetime applicationLifetime;
13-
private readonly IGitVersionRunner gitVersionRunner;
13+
private readonly IGitVersionExecutor gitVersionExecutor;
1414
private readonly Arguments arguments;
1515

16-
public GitVersionApp(IHostApplicationLifetime applicationLifetime, IGitVersionRunner gitVersionRunner, ILog log, IOptions<Arguments> options)
16+
public GitVersionApp(IHostApplicationLifetime applicationLifetime, IGitVersionExecutor gitVersionExecutor, ILog log, IOptions<Arguments> options)
1717
{
1818
this.arguments = options.Value;
1919
this.applicationLifetime = applicationLifetime;
20-
this.gitVersionRunner = gitVersionRunner;
20+
this.gitVersionExecutor = gitVersionExecutor;
2121

2222
log.Verbosity = arguments.Verbosity;
2323
}
2424
public Task StartAsync(CancellationToken cancellationToken)
2525
{
2626
try
2727
{
28-
gitVersionRunner.Run(arguments);
28+
gitVersionExecutor.Run(arguments);
2929
}
3030
catch (Exception exception)
3131
{

src/GitVersionExe/Module.cs renamed to src/GitVersionExe/GitVersionExeModule.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
namespace GitVersion
55
{
6-
public class Module : IModule
6+
public class GitVersionExeModule : IModule
77
{
88
public void RegisterTypes(IServiceCollection services)
99
{
1010
services.AddSingleton<IArgumentParser, ArgumentParser>();
1111
services.AddSingleton<IHelpWriter, HelpWriter>();
1212
services.AddSingleton<IVersionWriter, VersionWriter>();
13-
services.AddSingleton<IGitVersionRunner, GitVersionRunner>();
13+
services.AddSingleton<IGitVersionExecutor, GitVersionExecutor>();
1414

1515
services.AddTransient<IExecCommand, ExecCommand>();
1616
}

src/GitVersionExe/GitVersionRunner.cs renamed to src/GitVersionExe/GitVersionExecutor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace GitVersion
1212
{
13-
public class GitVersionRunner : IGitVersionRunner
13+
public class GitVersionExecutor : IGitVersionExecutor
1414
{
1515
private readonly IFileSystem fileSystem;
1616
private readonly ILog log;
@@ -19,7 +19,7 @@ public class GitVersionRunner : IGitVersionRunner
1919
private readonly IExecCommand execCommand;
2020
private readonly IVersionWriter versionWriter;
2121

22-
public GitVersionRunner(IFileSystem fileSystem, ILog log, IConfigFileLocator configFileLocator, IVersionWriter versionWriter, IHelpWriter helpWriter, IExecCommand execCommand)
22+
public GitVersionExecutor(IFileSystem fileSystem, ILog log, IConfigFileLocator configFileLocator, IVersionWriter versionWriter, IHelpWriter helpWriter, IExecCommand execCommand)
2323
{
2424
this.fileSystem = fileSystem;
2525
this.log = log;
@@ -105,7 +105,7 @@ private int VerifyArgumentsAndRun(Arguments arguments)
105105
return 0;
106106
}
107107

108-
execCommand.Execute();
108+
execCommand.Compute();
109109
}
110110
catch (WarningException exception)
111111
{

src/GitVersionExe/IExecCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ namespace GitVersion
22
{
33
public interface IExecCommand
44
{
5-
void Execute();
5+
void Compute();
66
}
77
}

0 commit comments

Comments
 (0)