예제 #1
0
        public static void NoCommits(string path, Repository repo, Version actualVersion)
        {
            $"Given an empty git repository in '{path = GetScenarioDirectory($"minimum-major-minor-not-tagged")}'"
            .x(c => repo = EnsureEmptyRepository(path).Using(c));

            "When the version is determined using minimum major minor '1.2'"
            .x(() => actualVersion = Versioner.GetVersion(repo, default, new MajorMinor(1, 2), default, new TestLogger()));
예제 #2
0
파일: Program.cs 프로젝트: slang25/minver
        private static Version GetVersion(string repoOrWorkDir, string tagPrefix, MajorMinor minMajorMinor, string buildMeta, Verbosity verbosity)
        {
            var log = new Logger(verbosity);

            if (log.IsDebugEnabled)
            {
                log.Debug($"MinVer {informationalVersion}.");
            }

            if (!RepositoryEx.TryCreateRepo(repoOrWorkDir, out var repo))
            {
                var version = new Version(minMajorMinor?.Major ?? 0, minMajorMinor?.Minor ?? 0, buildMeta);

                log.WarnIsNotAValidRepositoryOrWorkDirUsingDefaultVersion(repoOrWorkDir, version);

                return(version);
            }

            try
            {
                return(Versioner.GetVersion(repo, tagPrefix, minMajorMinor, buildMeta, log));
            }
            finally
            {
                repo.Dispose();
            }
        }
예제 #3
0
        public static void NoCommits(string path, Version actualVersion)
        {
            $"Given an empty git repository in {path = MethodBase.GetCurrentMethod().GetTestDirectory()}"
            .x(() => EnsureEmptyRepository(path));

            "When the version is determined using minimum major minor '1.2'"
            .x(() => actualVersion = Versioner.GetVersion(path, default, new MajorMinor(1, 2), default, default, default, default));
예제 #4
0
        public static void TagPrefix(string tag, string prefix, string expectedVersion, string path, Repository repo, Version actualVersion)
        {
            $"Given a git repository with a commit in '{path = GetScenarioDirectory($"tag-prefixes-{tag}")}'"
            .x(c => repo = EnsureEmptyRepositoryAndCommit(path).Using(c));

            $"And the commit is tagged '{tag}'"
            .x(() => repo.ApplyTag(tag));

            $"When the version is determined using the tag prefix '{prefix}'"
            .x(() => actualVersion = Versioner.GetVersion(path, prefix, default, default, new TestLogger()));
예제 #5
0
파일: TagPrefixes.cs 프로젝트: 0xced/minver
        public static void TagPrefix(string tag, string prefix, string expectedVersion, string path, Version actualVersion)
        {
            $"Given a git repository with a commit in {path = MethodBase.GetCurrentMethod().GetTestDirectory(tag)}"
            .x(() => EnsureEmptyRepositoryAndCommit(path));

            $"And the commit is tagged '{tag}'"
            .x(() => Tag(path, tag));

            $"When the version is determined using the tag prefix '{prefix}'"
            .x(() => actualVersion = Versioner.GetVersion(path, prefix, default, default, default, default, default));
예제 #6
0
        public static void NoCommits(string buildMetadata, string expectedVersion, string path, Version actualVersion)
        {
            $"Given an empty git repository in '{path = GetScenarioDirectory($"build-metadata-no-tag-{buildMetadata}")}'"
            .x(c => EnsureEmptyRepository(path).Using(c));

            $"When the version is determined using build metadata '{buildMetadata}'"
            .x(() => actualVersion = Versioner.GetVersion(path, default, default, buildMetadata, default, new TestLogger()));
예제 #7
0
        public static void RtmVersionIncrement(string tag, VersionPart autoIncrement, string expectedVersion, string path, Repository repo, Version actualVersion)
        {
            $"Given a git repository with a commit in '{path = GetScenarioDirectory($"rtm-auto-increment-{tag}")}'"
            .x(c => repo = EnsureEmptyRepositoryAndCommit(path).Using(c));

            $"And the commit is tagged '{tag}'"
            .x(() => repo.ApplyTag(tag));

            $"And another commit"
            .x(() => Commit(path));

            $"When the version is determined using auto-increment '{autoIncrement}'"
            .x(() => actualVersion = Versioner.GetVersion(path, default, default, default, autoIncrement, default, new TestLogger()));
예제 #8
0
        public static void DefaultPreReleasePhase(string phase, string expectedVersion, string path, Version actualVersion)
        {
            $"Given a git repository with a commit in '{path = GetScenarioDirectory($"default-pre-release-phase-{phase}")}'"
            .x(() => EnsureEmptyRepositoryAndCommit(path));

            $"When the version is determined using the default pre-release phase '{phase}'"
            .x(() => actualVersion = Versioner.GetVersion(path, default, default, default, default, phase, new TestLogger()));
예제 #9
0
        public static void NoCommits(string buildMetadata, string expectedVersion, string path, Version actualVersion)
        {
            $"Given an empty git repository in {path = MethodBase.GetCurrentMethod().GetTestDirectory(buildMetadata)}"
            .x(() => EnsureEmptyRepository(path));

            $"When the version is determined using build metadata '{buildMetadata}'"
            .x(() => actualVersion = Versioner.GetVersion(path, default, default, buildMetadata, default, default, default));
예제 #10
0
        public static void RtmVersionIncrement(string tag, VersionPart autoIncrement, string expectedVersion, string path, Version actualVersion)
        {
            $"Given a git repository with a commit in {path = MethodBase.GetCurrentMethod().GetTestDirectory(autoIncrement)}"
            .x(() => EnsureEmptyRepositoryAndCommit(path));

            $"And the commit is tagged '{tag}'"
            .x(() => Tag(path, tag));

            "And another commit"
            .x(() => Commit(path));

            $"When the version is determined using auto-increment '{autoIncrement}'"
            .x(() => actualVersion = Versioner.GetVersion(path, default, default, default, autoIncrement, default, default));
예제 #11
0
        public static void DefaultPreReleasePhase(string phase, string expectedVersion, string path, Version actualVersion)
        {
            $"Given a git repository with a commit in {path = MethodBase.GetCurrentMethod().GetTestDirectory(phase)}"
            .x(() => EnsureEmptyRepositoryAndCommit(path));

            $"When the version is determined using the default pre-release phase '{phase}'"
            .x(() => actualVersion = Versioner.GetVersion(path, default, default, default, default, phase, default));