diff --git a/GitVersionCore.Tests/ConfigProviderTests.cs b/GitVersionCore.Tests/ConfigProviderTests.cs index fc40be2921..5396bd410f 100644 --- a/GitVersionCore.Tests/ConfigProviderTests.cs +++ b/GitVersionCore.Tests/ConfigProviderTests.cs @@ -83,7 +83,9 @@ public void CanReadDefaultDocument() public void VerifyInit() { var config = typeof(Config); - var aliases = config.GetProperties().Where(p => p.GetCustomAttribute() == null).Select(p => ((YamlAliasAttribute) p.GetCustomAttribute(typeof(YamlAliasAttribute))).Alias); + var aliases = config.GetProperties() + .Where(p => p.GetCustomAttribute() == null) + .Select(p => ((YamlMemberAttribute) p.GetCustomAttribute(typeof(YamlMemberAttribute))).Alias); var writer = new StringWriter(); ConfigReader.WriteSample(writer); @@ -99,7 +101,10 @@ public void VerifyInit() public void VerifyAliases() { var config = typeof(Config); - var propertiesMissingAlias = config.GetProperties().Where(p => p.GetCustomAttribute() == null).Where(p => p.GetCustomAttribute(typeof(YamlAliasAttribute)) == null).Select(p => p.Name); + var propertiesMissingAlias = config.GetProperties() + .Where(p => p.GetCustomAttribute() == null) + .Where(p => p.GetCustomAttribute(typeof(YamlMemberAttribute)) == null) + .Select(p => p.Name); propertiesMissingAlias.ShouldBeEmpty(); } diff --git a/GitVersionCore.Tests/Fixtures/BaseGitFlowRepositoryFixture.cs b/GitVersionCore.Tests/Fixtures/BaseGitFlowRepositoryFixture.cs index 70b6d501d8..64800c90cf 100644 --- a/GitVersionCore.Tests/Fixtures/BaseGitFlowRepositoryFixture.cs +++ b/GitVersionCore.Tests/Fixtures/BaseGitFlowRepositoryFixture.cs @@ -32,7 +32,7 @@ void SetupRepo(Action initialMasterAction) { var randomFile = Path.Combine(Repository.Info.WorkingDirectory, Guid.NewGuid().ToString()); File.WriteAllText(randomFile, string.Empty); - Repository.Index.Stage(randomFile); + Repository.Stage(randomFile); initialMasterAction(Repository); diff --git a/GitVersionCore/Configuration/BranchConfig.cs b/GitVersionCore/Configuration/BranchConfig.cs index 2f09fd4f90..b24942d096 100644 --- a/GitVersionCore/Configuration/BranchConfig.cs +++ b/GitVersionCore/Configuration/BranchConfig.cs @@ -15,16 +15,16 @@ public BranchConfig(BranchConfig branchConfiguration) Increment = branchConfiguration.Increment; } - [YamlAlias("mode")] + [YamlMember(Alias = "mode")] public VersioningMode? VersioningMode { get; set; } /// /// Special value 'useBranchName' will extract the tag from the branch name /// - [YamlAlias("tag")] + [YamlMember(Alias = "tag")] public string Tag { get; set; } - [YamlAlias("increment")] + [YamlMember(Alias = "increment")] public IncrementStrategy? Increment { get; set; } } } diff --git a/GitVersionCore/Configuration/Config.cs b/GitVersionCore/Configuration/Config.cs index 2d602b338f..6e8752480f 100644 --- a/GitVersionCore/Configuration/Config.cs +++ b/GitVersionCore/Configuration/Config.cs @@ -28,13 +28,19 @@ public Config() }; } - [YamlAlias("assembly-versioning-scheme")] + [YamlMember(Alias = "assembly-versioning-scheme")] public AssemblyVersioningScheme AssemblyVersioningScheme { get; set; } - [YamlAlias("mode")] + [YamlMember(Alias = "mode")] public VersioningMode? VersioningMode { get; set; } - [YamlAlias("branches")] + [YamlMember(Alias = "tag-prefix")] + public string TagPrefix { get; set; } + + [YamlMember(Alias = "next-version")] + public string NextVersion { get; set; } + + [YamlMember(Alias = "branches")] public Dictionary Branches { get @@ -57,11 +63,5 @@ private T MergeObjects(T target, T source) .ForEach(_ => _.prop.SetValue(target, _.value, null)); return target; } - - [YamlAlias("tag-prefix")] - public string TagPrefix { get; set; } - - [YamlAlias("next-version")] - public string NextVersion { get; set; } } } \ No newline at end of file diff --git a/GitVersionCore/Configuration/LegacyConfig.cs b/GitVersionCore/Configuration/LegacyConfig.cs index 0152428458..dea5a9076d 100644 --- a/GitVersionCore/Configuration/LegacyConfig.cs +++ b/GitVersionCore/Configuration/LegacyConfig.cs @@ -9,10 +9,10 @@ public class LegacyConfig { public string assemblyVersioningScheme { get; set; } - [YamlAlias("develop-branch-tag")] + [YamlMember(Alias = "develop-branch-tag")] public string DevelopBranchTag { get; set; } - [YamlAlias("release-branch-tag")] + [YamlMember(Alias = "release-branch-tag")] public string ReleaseBranchTag { get; set; } } } \ No newline at end of file diff --git a/GitVersionTask.Tests/GitFlow/GitFlowVersionFinderTests.cs b/GitVersionTask.Tests/GitFlow/GitFlowVersionFinderTests.cs index 16d89a4547..c36a91aac9 100644 --- a/GitVersionTask.Tests/GitFlow/GitFlowVersionFinderTests.cs +++ b/GitVersionTask.Tests/GitFlow/GitFlowVersionFinderTests.cs @@ -137,7 +137,7 @@ public void AReleaseBranchIsRequiredToBranchOffOfDevelopBranch() var path = Path.Combine(repo.Info.WorkingDirectory, "README"); File.AppendAllText(path, "Release\n"); - repo.Index.Stage(path); + repo.Stage(path); var sign = SignatureBuilder.SignatureNow(); repo.Commit("release unborn", sign, sign); diff --git a/GitVersionTask.Tests/GitVersionTask.Tests.csproj b/GitVersionTask.Tests/GitVersionTask.Tests.csproj index 2fe89a0f0a..730d2522ed 100644 --- a/GitVersionTask.Tests/GitVersionTask.Tests.csproj +++ b/GitVersionTask.Tests/GitVersionTask.Tests.csproj @@ -99,8 +99,6 @@ - - diff --git a/GitVersionTask.Tests/Helpers/Constants.cs b/GitVersionTask.Tests/Helpers/Constants.cs deleted file mode 100644 index 031f210299..0000000000 --- a/GitVersionTask.Tests/Helpers/Constants.cs +++ /dev/null @@ -1,6 +0,0 @@ - -public static class Constants -{ - public const string TemporaryReposPath = "TestRepos"; - -} \ No newline at end of file diff --git a/GitVersionTask.Tests/Helpers/Lg2sHelperBase.cs b/GitVersionTask.Tests/Helpers/Lg2sHelperBase.cs index 913529e86b..64d7bdcdff 100644 --- a/GitVersionTask.Tests/Helpers/Lg2sHelperBase.cs +++ b/GitVersionTask.Tests/Helpers/Lg2sHelperBase.cs @@ -8,6 +8,7 @@ public abstract class Lg2sHelperBase : IPostTestDirectoryRemover { + public const string TemporaryReposPath = "TestRepos"; List directories; [TestFixtureSetUp] @@ -30,9 +31,9 @@ static Lg2sHelperBase() // Do the set up in the static ctor so it only happens once SetUpTestEnvironment(); - if (Directory.Exists(Constants.TemporaryReposPath)) + if (Directory.Exists(TemporaryReposPath)) { - DirectoryHelper.DeleteSubDirectories(Constants.TemporaryReposPath); + DirectoryHelper.DeleteSubDirectories(TemporaryReposPath); } } @@ -58,7 +59,7 @@ static void SetUpTestEnvironment() protected SelfCleaningDirectory BuildSelfCleaningDirectory() { - return new SelfCleaningDirectory(this); + return new SelfCleaningDirectory(this, BuildTempPath()); } protected SelfCleaningDirectory BuildSelfCleaningDirectory(string path) @@ -66,6 +67,11 @@ protected SelfCleaningDirectory BuildSelfCleaningDirectory(string path) return new SelfCleaningDirectory(this, path); } + protected static string BuildTempPath() + { + return Path.Combine(TemporaryReposPath, Guid.NewGuid().ToString().Substring(0, 8)); + } + protected string Clone(string sourceDirectoryPath, params string[] additionalSourcePaths) { var scd = BuildSelfCleaningDirectory(); @@ -101,7 +107,7 @@ protected static Commit AddOneCommitToHead(Repository repo, string type) { var randomFile = Path.Combine(repo.Info.WorkingDirectory, Guid.NewGuid().ToString()); File.WriteAllText(randomFile, string.Empty); - repo.Index.Stage(randomFile); + repo.Stage(randomFile); var sign = SignatureBuilder.SignatureNow(); return repo.Commit(type + " commit", sign, sign); } @@ -110,7 +116,7 @@ protected static void AddTag(Repository repo, string tagName) { var randomFile = Path.Combine(repo.Info.WorkingDirectory, Guid.NewGuid().ToString()); File.WriteAllText(randomFile, string.Empty); - repo.Index.Stage(randomFile); + repo.Stage(randomFile); var sign = SignatureBuilder.SignatureNow(); repo.ApplyTag(tagName, repo.Head.Tip.Id.Sha, sign, "foo"); } diff --git a/GitVersionTask.Tests/Helpers/SelfCleaningDirectory.cs b/GitVersionTask.Tests/Helpers/SelfCleaningDirectory.cs index 4f6fd14268..465d6b6219 100644 --- a/GitVersionTask.Tests/Helpers/SelfCleaningDirectory.cs +++ b/GitVersionTask.Tests/Helpers/SelfCleaningDirectory.cs @@ -3,11 +3,6 @@ public class SelfCleaningDirectory { - public SelfCleaningDirectory(IPostTestDirectoryRemover directoryRemover) - : this(directoryRemover, BuildTempPath()) - { - } - public SelfCleaningDirectory(IPostTestDirectoryRemover directoryRemover, string path) { if (Directory.Exists(path)) @@ -20,9 +15,4 @@ public SelfCleaningDirectory(IPostTestDirectoryRemover directoryRemover, string } public string DirectoryPath; - - protected static string BuildTempPath() - { - return Path.Combine(Constants.TemporaryReposPath, Guid.NewGuid().ToString().Substring(0, 8)); - } } \ No newline at end of file