Skip to content

Commit

Permalink
feat(ChangeLog): add closed issues to ChangeLog
Browse files Browse the repository at this point in the history
  • Loading branch information
tschulte committed Sep 15, 2015
1 parent 3c152ed commit 746f8f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
10 changes: 7 additions & 3 deletions src/main/resources/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<a name="${version}"></a>
<%= if (version.endsWith('.0')) '#' else '##' %> <%= if (versionUrl) "[$version]($versionUrl)" else version %><%= if (title) " \"$title\"" else "" %><%= if (date) " ($date)" else "" %>
<%
def commitText(commit) {
def closes = service.closes(commit).collect { "#$it" }
"${service.subject(commit)} (${service.commitish(commit)}${closes ? (', closes ' + closes.join(', ')) : ''})"
}
def changeGroup(String title, group) {
if (group) {
println()
Expand All @@ -9,16 +13,16 @@ def changeGroup(String title, group) {
group.each { component, commits ->
if (!component) {
commits.each { commit ->
println "* ${service.subject(commit)} (${service.commitish(commit)})"
println "* ${commitText(commit)}"
}
} else {
print "* ${component ? "**$component:**" : ""}"
if (component && commits.size() == 1)
println " ${service.subject(commits[0])} (${service.commitish(commits[0])})"
println " ${commitText(commits[0])}"
else {
println()
commits.each { commit ->
println " * ${service.subject(commit)} (${service.commitish(commit)})"
println " * ${commitText(commit)}"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ class SemanticReleaseChangeLogServiceSpec extends Specification {

when:
def commits = [
'fix(component1): foo',
'fix(component1): foo\n\nCloses #123, #124',
'fix(component1): bar',
'fix(component2): baz',
'fix: no component',
'feat: baz\n\nBREAKING CHANGE: This and that', 'foo bar']
'fix(component2): baz\n\nCloses #123\nCloses #124',
'fix: no component\n\nCloses #456, #789',
'feat: baz\n\nCloses #159\n\nBREAKING CHANGE: This and that', 'foo bar']
def expected = """\
<a name="2.0.0"></a>
# [2.0.0](https://github.com/tschulte/gradle-semantic-release-plugin/compare/v1.0.0...v2.0.0) (${
Expand All @@ -196,15 +196,15 @@ class SemanticReleaseChangeLogServiceSpec extends Specification {
### Bug Fixes
* no component ([1234567](https://github.com/tschulte/gradle-semantic-release-plugin/commit/1234567))
* no component ([1234567](https://github.com/tschulte/gradle-semantic-release-plugin/commit/1234567), closes #456, #789)
* **component1:**
* foo ([1234567](https://github.com/tschulte/gradle-semantic-release-plugin/commit/1234567))
* foo ([1234567](https://github.com/tschulte/gradle-semantic-release-plugin/commit/1234567), closes #123, #124)
* bar ([1234567](https://github.com/tschulte/gradle-semantic-release-plugin/commit/1234567))
* **component2:** baz ([1234567](https://github.com/tschulte/gradle-semantic-release-plugin/commit/1234567))
* **component2:** baz ([1234567](https://github.com/tschulte/gradle-semantic-release-plugin/commit/1234567), closes #123, #124)
### Features
* baz ([1234567](https://github.com/tschulte/gradle-semantic-release-plugin/commit/1234567))
* baz ([1234567](https://github.com/tschulte/gradle-semantic-release-plugin/commit/1234567), closes #159)
### BREAKING CHANGES
Expand Down

0 comments on commit 746f8f2

Please sign in to comment.