예제 #1
0
        public void MultipleReleases()
        {
            var releaseNotes = new SemanticReleaseNotes(new[]
            {
                new SemanticRelease("", null, new List <IReleaseNoteLine>
                {
                    new ReleaseNoteItem("Issue 1", "#1", new Uri("http://github.com/org/repo/issues/1"),
                                        new[] { "feature" }, DateTimeOffset.Now, new Contributor[0])
                }, new ReleaseDiffInfo
                {
                    BeginningSha = "12345678",
                    EndSha       = "67890123"
                }),
                new SemanticRelease("1.2.0", new DateTimeOffset(2013, 12, 06, 0, 0, 0, new TimeSpan()), new List <IReleaseNoteLine>
                {
                    new ReleaseNoteItem("Issue 2", "#2", new Uri("http://github.com/org/repo/issues/2"),
                                        new[] { "feature" }, DateTimeOffset.Now, new Contributor[0]),
                    new ReleaseNoteItem("Issue 3", "#3", new Uri("http://github.com/org/repo/issues/3"),
                                        new[] { "bug" }, DateTimeOffset.Now, new Contributor[0])
                }, new ReleaseDiffInfo
                {
                    BeginningSha = "asdsadaf",
                    EndSha       = "bfdsadre"
                })
            }, new[] { "bug", "enhancement", "feature" });

            var result = releaseNotes.ToString();

            Approvals.Verify(result);
        }
예제 #2
0
        public void CanReadReleaseNotesContainingMultipleReleases()
        {
            const string releaseNotes     = @"# vNext

 - Issue 1 [#1](http://github.com/org/repo/issues/1) +feature +new

Commits: 12345678...67890123


# 1.2.0 (06 December 2013)

 - Issue 2 [#2](http://github.com/org/repo/issues/2) +feature
 - Issue 3 [#3](http://github.com/org/repo/issues/3) +fix

Commits: asdsadaf...bfdsadre
";
            var          readReleaseNotes = SemanticReleaseNotes.Parse(releaseNotes);

            readReleaseNotes.Releases.Length.ShouldBe(2);
            readReleaseNotes.Releases[0].DiffInfo.BeginningSha.ShouldBe("12345678");
            readReleaseNotes.Releases[0].DiffInfo.EndSha.ShouldBe("67890123");
            readReleaseNotes.Releases[0].ReleaseName.ShouldBe(null);
            readReleaseNotes.Releases[0].When.ShouldBe(null);
            readReleaseNotes.Releases[0].ReleaseNoteLines.Count.ShouldBe(1);
            readReleaseNotes.Releases[0].ReleaseNoteItems[0].Title.ShouldBe("Issue 1 [#1](http://github.com/org/repo/issues/1) +feature +new");
            readReleaseNotes.Releases[1].DiffInfo.BeginningSha.ShouldBe("asdsadaf");
            readReleaseNotes.Releases[1].DiffInfo.EndSha.ShouldBe("bfdsadre");
            readReleaseNotes.Releases[1].ReleaseName.ShouldBe("1.2.0");
            readReleaseNotes.Releases[1].When.ShouldBe(new DateTimeOffset(new DateTime(2013, 12, 6)));
            readReleaseNotes.Releases[1].ReleaseNoteLines.Count.ShouldBe(2);
            readReleaseNotes.Releases[1].ReleaseNoteItems[0].Title.ShouldBe("Issue 2 [#2](http://github.com/org/repo/issues/2) +feature");
            readReleaseNotes.Releases[1].ReleaseNoteItems[1].Title.ShouldBe("Issue 3 [#3](http://github.com/org/repo/issues/3) +fix");
        }
예제 #3
0
        public void KeepsCustomisations()
        {
            IRepository   repo;
            IIssueTracker issueTracker;

            new TestDataCreator(new DateTimeOffset(2012, 1, 1, 0, 0, 0, new TimeSpan()))
            .CreateRelease("0.1.0", "Issue1", "Issue2")
            .CreateRelease("0.2.0", "Issue3")
            .Build(out repo, out issueTracker);

            var tagToStartFrom     = GitRepositoryInfoFinder.GetFirstCommit(repo);
            var currentReleaseInfo = GitRepositoryInfoFinder.GetCurrentReleaseInfo(repo);

            var previousReleaseNotes = SemanticReleaseNotes.Parse(@"# vNext


Commits: ...


# 0.2.0 (05 January 2012)

**Note this release does some stuff!**


 - [2] - Edited Issue3

Another comment

Commits:  AC39885536...CA74E870F2


# 0.1.0 (03 January 2012)

## Features
 - [0] - Edited Issue1
 - [1] - Edited Issue2
 - [2] - Edited Issue3

## Fixes
 - [3] - Edited Issue4
 - [4] - Edited Issue5

This is a comment about the release

Which spans multiple lines


Commits: E413A880DB...F6924D7A0B");

            var releaseNotes = ReleaseNotesGenerator.GenerateReleaseNotes(
                repo, issueTracker, previousReleaseNotes, new Categories(),
                tagToStartFrom, currentReleaseInfo, "url/{0}...{1}");

            Approvals.Verify(releaseNotes.ToString(), Scrubber);
        }
        public SemanticReleaseNotes ReadPreviousReleaseNotes(string releaseNotesFileName)
        {
            var path = Path.Combine(_repositoryRoot, releaseNotesFileName);

            if (!_fileSystem.FileExists(path))
            {
                return(new SemanticReleaseNotes());
            }
            var contents = _fileSystem.ReadAllText(path).Replace("\r", string.Empty);

            return(SemanticReleaseNotes.Parse(contents));
        }
        public void AdditionalCategoriesCanBeSpecifiedOnCommandLine()
        {
            var arguments = new GitReleaseNotesArguments
            {
                Categories = "internal refactoring",
                OutputFile = "ReleaseFile.md"
            };
            var releaseNotes = new SemanticReleaseNotes(new[]
            {
                new ReleaseNoteItem("Issue 1", "#1", new Uri("http://github.com/org/repo/issues/1"), new[]{"internal refactoring"})
            });

            _sut.WriteReleaseNotes(arguments, releaseNotes);

            Approvals.Verify(GetContent());
        }
예제 #6
0
        public void CanReadCategorisedIssuesReleaseNotes()
        {
            const string releaseNotes = @" - Issue 1 [#1](http://github.com/org/repo/issues/1) +feature +new

Commits: 12345678...67890123
";

            var readReleaseNotes = SemanticReleaseNotes.Parse(releaseNotes);

            readReleaseNotes.Releases.Length.ShouldBe(1);
            readReleaseNotes.Releases[0].DiffInfo.BeginningSha.ShouldBe("12345678");
            readReleaseNotes.Releases[0].DiffInfo.EndSha.ShouldBe("67890123");
            readReleaseNotes.Releases[0].ReleaseName.ShouldBe(null);
            readReleaseNotes.Releases[0].ReleaseNoteItems.Length.ShouldBe(1);
            readReleaseNotes.Releases[0].ReleaseNoteItems[0].Title.ShouldBe("Issue 1 [#1](http://github.com/org/repo/issues/1) +feature +new");
        }
예제 #7
0
        public void CanReadBasicReleaseNotes()
        {
            const string releaseNotes = @" - Issue 1 [#1](http://github.com/org/repo/issues/1)

Commits: 1234567...6789012
";

            var readReleaseNotes = SemanticReleaseNotes.Parse(releaseNotes);

            readReleaseNotes.Releases.Length.ShouldBe(1);
            readReleaseNotes.Releases[0].DiffInfo.BeginningSha.ShouldBe("1234567");
            readReleaseNotes.Releases[0].DiffInfo.EndSha.ShouldBe("6789012");
            readReleaseNotes.Releases[0].ReleaseName.ShouldBe(null);
            readReleaseNotes.Releases[0].ReleaseNoteLines.Count.ShouldBe(1);
            readReleaseNotes.Releases[0].ReleaseNoteItems[0].Title.ShouldBe("Issue 1 [#1](http://github.com/org/repo/issues/1)");
        }
        public void AbsolutePathIsWrittenToRepositoryRoot()
        {
            var arguments = new GitReleaseNotesArguments
            {
                Categories = "internal refactoring",
                OutputFile = "c:\\AnotherDir\\ReleaseFile.md"
            };
            var releaseNotes = new SemanticReleaseNotes(new[]
            {
                new ReleaseNoteItem("Issue 1", "#1", new Uri("http://github.com/org/repo/issues/1"), new string[0])
            });

            _sut.WriteReleaseNotes(arguments, releaseNotes);

            var fileName = _fileSystem.ReceivedCalls().Single(c => c.GetMethodInfo().Name == "WriteAllText").GetArguments()[0];
            Assert.Equal("c:\\AnotherDir\\ReleaseFile.md", fileName);
        }
예제 #9
0
        public void LabelOfBugIsCategorisedAsFix()
        {
            var releaseNotes = new SemanticReleaseNotes(new[]
            {
                new SemanticRelease("", null, new List <IReleaseNoteLine>
                {
                    new ReleaseNoteItem("Issue 1", "#1", new Uri("http://github.com/org/repo/issues/1"), new[] { "bug" }, DateTimeOffset.Now, new Contributor[0])
                }, new ReleaseDiffInfo
                {
                    BeginningSha = "12345678",
                    EndSha       = "67890123"
                })
            }, new Categories(new[] { "bug", "enhancement", "feature" }, true));

            var result = releaseNotes.ToString();

            Approvals.Verify(result);
        }
        public void CanReadReleaseNotesWithXmlDateFormat()
        {
            const string releaseNotes     = @"# v0.1.0 (2016-08-29)

 - Issue 1 [#1](http://github.com/org/repo/issues/1) +feature +new

Commits: 12345678...67890123
";
            var          readReleaseNotes = SemanticReleaseNotes.Parse(releaseNotes);

            readReleaseNotes.Releases.Length.ShouldBe(1);
            readReleaseNotes.Releases[0].DiffInfo.BeginningSha.ShouldBe("12345678");
            readReleaseNotes.Releases[0].DiffInfo.EndSha.ShouldBe("67890123");
            readReleaseNotes.Releases[0].ReleaseName.ShouldBe("v0.1.0");
            readReleaseNotes.Releases[0].When.ShouldBe(new DateTimeOffset(new DateTime(2016, 08, 29)));
            readReleaseNotes.Releases[0].ReleaseNoteLines.Count.ShouldBe(1);
            readReleaseNotes.Releases[0].ReleaseNoteItems[0].Title.ShouldBe("Issue 1 [#1](http://github.com/org/repo/issues/1) +feature +new");
        }
예제 #11
0
        public void ItemIsNotCategorisedWithMultipleCategoriesIfAllLabelsIsFalse()
        {
            var releaseNotes = new SemanticReleaseNotes(new[]
            {
                new SemanticRelease("", null, new List <IReleaseNoteLine>
                {
                    new ReleaseNoteItem("Issue 1", "#1", new Uri("http://github.com/org/repo/issues/1"),
                                        new[] { "feature", "enhancement", "breaking-change" }, DateTimeOffset.Now, new Contributor[0])
                }, new ReleaseDiffInfo
                {
                    BeginningSha = "12345678",
                    EndSha       = "67890123"
                })
            }, new Categories("feature", false));

            var result = releaseNotes.ToString();

            Approvals.Verify(result);
        }
예제 #12
0
        public void AdditionalCategoriesCanBeSpecifiedOnCommandLine()
        {
            var releaseNotes = new SemanticReleaseNotes(new[]
            {
                new SemanticRelease("", null, new ReleaseDiffInfo
                {
                    BeginningSha = "12345678",
                    EndSha       = "67890123"
                }, new List <IReleaseNoteLine>
                {
                    new ReleaseNoteItem("Issue 1", "#1", "http://github.com/org/repo/issues/1",
                                        new[] { "internal refactoring" }, DateTimeOffset.Now, new Contributor[0])
                })
            }, new Categories(new[] { "internal refactoring" }, true));

            var result = releaseNotes.ToString();

            Approvals.Verify(result);
        }
        public void ApproveSimpleTests()
        {
            var releaseNotes = new SemanticReleaseNotes(new[]
            {
                new SemanticRelease("", null, new List<IReleaseNoteLine>
                {
                    new ReleaseNoteItem("Issue 1", "#1", new Uri("http://github.com/org/repo/issues/1"), new string[0], DateTime.Now, new[]{ new Contributor("Foo Bar", "@foo", "http://url.com/foo") }),
                    new ReleaseNoteItem("Issue 1", null, null, new string[0], DateTime.Now, new Contributor[0])
                }, new ReleaseDiffInfo
                {
                    BeginningSha = "12345678",
                    EndSha = "67890123"
                })
            }, new string[0]);

            var result = releaseNotes.ToString();

            Approvals.Verify(result);
        }
        public void AdditionalCategoriesCanBeSpecifiedOnCommandLine()
        {
            var releaseNotes = new SemanticReleaseNotes(new[]
            {
                new SemanticRelease("", null, new List<IReleaseNoteLine>
                {
                    new ReleaseNoteItem("Issue 1", "#1", new Uri("http://github.com/org/repo/issues/1"),
                        new[] {"internal refactoring"}, DateTimeOffset.Now, new Contributor[0])
                }, new ReleaseDiffInfo
                {
                    BeginningSha = "12345678",
                    EndSha = "67890123"
                })
            }, new[] { "internal refactoring" });

            var result = releaseNotes.ToString();

            Approvals.Verify(result);
        }
예제 #15
0
        public void ApproveSimpleTests()
        {
            var releaseNotes = new SemanticReleaseNotes(new[]
            {
                new SemanticRelease("", null, new List <IReleaseNoteLine>
                {
                    new ReleaseNoteItem("Issue 1", "#1", new Uri("http://github.com/org/repo/issues/1"), new string[0], DateTime.Now, new[] { new Contributor("Foo Bar", "@foo", "http://url.com/foo") }),
                    new ReleaseNoteItem("Issue 1", null, null, new string[0], DateTime.Now, new Contributor[0])
                }, new ReleaseDiffInfo
                {
                    BeginningSha = "12345678",
                    EndSha       = "67890123"
                })
            }, new Categories());

            var result = releaseNotes.ToString();

            Approvals.Verify(result);
        }
예제 #16
0
        public void CanReadReleaseNotesWithComments()
        {
            const string releaseNotes = @" - Issue 1 [#1](http://github.com/org/repo/issues/1)

Note: Some shiz..

Commits: 1234567...6789012
";

            var readReleaseNotes = SemanticReleaseNotes.Parse(releaseNotes);

            readReleaseNotes.Releases.Length.ShouldBe(1);
            readReleaseNotes.Releases[0].DiffInfo.BeginningSha.ShouldBe("1234567");
            readReleaseNotes.Releases[0].DiffInfo.EndSha.ShouldBe("6789012");
            readReleaseNotes.Releases[0].ReleaseName.ShouldBe(null);
            readReleaseNotes.Releases[0].ReleaseNoteLines.Count.ShouldBe(3);
            readReleaseNotes.Releases[0].ReleaseNoteLines[0].ToString(new Categories()).ShouldBe(" - Issue 1 [#1](http://github.com/org/repo/issues/1)");
            readReleaseNotes.Releases[0].ReleaseNoteLines[1].ToString(new Categories()).ShouldBe(string.Empty);
            readReleaseNotes.Releases[0].ReleaseNoteLines[2].ToString(new Categories()).ShouldBe("Note: Some shiz..");
        }
        public void ItemIsCategorisedWithMultipleCategoriesIfAllLabelsIsTrue()
        {
            var releaseNotes = new SemanticReleaseNotes(new[]
            {
                new SemanticRelease("", null, new ReleaseDiffInfo
                {
                    BeginningSha = "12345678",
                    EndSha = "67890123"
                },
                new List<IReleaseNoteLine>
                {
                    new ReleaseNoteItem("Issue 1", "#1", "http://github.com/org/repo/issues/1",
                        new[] {"feature", "enhancement", "breaking-change"}, DateTimeOffset.Now, new Contributor[0])
                })
            }, new Categories("feature", true));

            var result = releaseNotes.ToString();

            Approvals.Verify(result);
        }
예제 #18
0
        public void AppendOnlyNewItems()
        {
            IRepository   repo;
            IIssueTracker issueTracker;

            new TestDataCreator(new DateTimeOffset(2012, 1, 1, 0, 0, 0, new TimeSpan()))
            .CreateRelease("0.1.0", "Issue1", "Issue2")
            .CreateRelease("0.2.0", "Issue3")
            .AddIssues("Issue4")
            .Build(out repo, out issueTracker);

            var tagToStartFrom     = GitRepositoryInfoFinder.GetFirstCommit(repo);
            var currentReleaseInfo = GitRepositoryInfoFinder.GetCurrentReleaseInfo(repo);

            var previousReleaseNotes = SemanticReleaseNotes.Parse(@"# vNext


Commits: ...


# 0.2.0 (05 January 2012)

 - [2] - Edited Issue3

Commits:  AC39885536...CA74E870F2


# 0.1.0 (03 January 2012)

 - [0] - Edited Issue1
 - [1] - Edited Issue2

Commits: E413A880DB...F6924D7A0B");

            var releaseNotes = ReleaseNotesGenerator.GenerateReleaseNotes(
                repo, issueTracker, previousReleaseNotes, new Categories(),
                tagToStartFrom, currentReleaseInfo, string.Empty);

            Approvals.Verify(releaseNotes.ToString(), Scrubber);
        }
        public void MultipleReleases()
        {
            var releaseNotes = new SemanticReleaseNotes(new[]
            {
                new SemanticRelease("", null, new List<IReleaseNoteLine>
                {
                    new ReleaseNoteItem("Issue 1", "#1", new Uri("http://github.com/org/repo/issues/1"),
                        new[] {"feature"}, DateTimeOffset.Now, new Contributor[0])
                }, new ReleaseDiffInfo
                {
                    BeginningSha = "12345678",
                    EndSha = "67890123"
                }),
                new SemanticRelease("1.2.0", new DateTimeOffset(2013, 12, 06, 0,0,0, new TimeSpan()), new List<IReleaseNoteLine>
                {
                    new ReleaseNoteItem("Issue 2", "#2", new Uri("http://github.com/org/repo/issues/2"),
                        new[] {"feature"}, DateTimeOffset.Now, new Contributor[0]),
                        new ReleaseNoteItem("Issue 3", "#3", new Uri("http://github.com/org/repo/issues/3"),
                        new[] {"bug"}, DateTimeOffset.Now, new Contributor[0])
                }, new ReleaseDiffInfo
                {
                    BeginningSha = "asdsadaf",
                    EndSha = "bfdsadre"
                })
            }, new[] { "bug", "enhancement", "feature" });

            var result = releaseNotes.ToString();

            Approvals.Verify(result);
        }
        public void LabelOfBugIsCategorisedAsFix()
        {
            var releaseNotes = new SemanticReleaseNotes(new[]
            {
                new SemanticRelease("", null, new List<IReleaseNoteLine>
                {
                    new ReleaseNoteItem("Issue 1", "#1", new Uri("http://github.com/org/repo/issues/1"), new[] {"bug"}, DateTimeOffset.Now, new Contributor[0])
                }, new ReleaseDiffInfo
                {
                    BeginningSha = "12345678",
                    EndSha = "67890123"
                })
            }, new[] { "bug", "enhancement", "feature" });

            var result = releaseNotes.ToString();

            Approvals.Verify(result);
        }
        public void ApproveSimpleTests()
        {
            var arguments = new GitReleaseNotesArguments
            {
                OutputFile = "ReleaseFile.md"
            };
            var releaseNotes = new SemanticReleaseNotes(new[]
            {

                new ReleaseNoteItem("Issue 1", "#1", new Uri("http://github.com/org/repo/issues/1"), new string[0])
            });

            _sut.WriteReleaseNotes(arguments, releaseNotes);

            Approvals.Verify(GetContent());
        }
        public void ItemIsCategorised()
        {
            var arguments = new GitReleaseNotesArguments
            {
                OutputFile = "ReleaseFile.md"
            };
            var releaseNotes = new SemanticReleaseNotes(new[]
            {
                new ReleaseNoteItem("Issue 1", "#1", new Uri("http://github.com/org/repo/issues/1"), new[]{"feature"})
            });

            _sut.WriteReleaseNotes(arguments, releaseNotes);

            Approvals.Verify(GetContent());
        }