Skip to content

Commit 0fb5a47

Browse files
authored
feat: add eachUrlPart helper (#189)
1 parent eaa9987 commit 0fb5a47

10 files changed

+3505
-12
lines changed

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
2-
#Wed Oct 16 22:16:00 CEST 2024
2+
#Wed Jan 15 14:18:26 CST 2025
33
description='Library for parsing report files from static code analysis'
44
group=se.bjurr.gitchangelog
55
sourceCompatibility=17
66
targetCompatibility=17
7-
version=2.4.1
7+
version=2.4.2

src/main/java/se/bjurr/gitchangelog/api/helpers/Helpers.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import java.util.Map;
3333
import java.util.TreeMap;
3434
import java.util.stream.Collectors;
35+
import se.bjurr.gitchangelog.api.model.Changelog;
3536
import se.bjurr.gitchangelog.api.model.Commit;
3637
import se.bjurr.gitchangelog.api.model.Issue;
3738
import se.bjurr.gitchangelog.api.model.Tag;
@@ -237,6 +238,12 @@ public static Map<String, Helper<?>> getAll() {
237238
(final Footer footer, final Options options) -> {
238239
return conditional(options, !footer.value.trim().isEmpty());
239240
});
241+
242+
helpers.put(
243+
"eachUrlPart",
244+
(final Changelog changelog, final Options options) -> {
245+
return each(options, changelog.getUrlParts());
246+
});
240247
return helpers;
241248
}
242249

src/test/java/se/bjurr/gitchangelog/api/GitChangelogApiTest.testThatFirstVersionCanBeGenerated.approved.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ Changelog of {{repoName}}.
4242
### Dependency updates
4343

4444
{{#commits}}
45-
{{#ifCommitType . type="feat"}}
46-
{{#ifCommitScope . scope="utils"}}
45+
{{#ifCommitType . type="chore"}}
46+
{{#ifCommitScope . scope="deps"}}
4747
- {{{commitDescription .}}} ([{{subString hash 0 5}}](https://github.com/{{ownerName}}/{{repoName}}/commit/{{hash}}) {{authorName}}) {{#eachCommitRefs .}}{{#ifMatches . "^#[0-9]+"}} [{{.}}](https://github.com/{{ownerName}}/{{repoName}}/issues/{{subString . 1}}) {{/ifMatches}}{{/eachCommitRefs}} {{#eachCommitFixes .}}{{#ifMatches . "^#[0-9]+"}} [{{.}}](https://github.com/{{ownerName}}/{{repoName}}/issues/{{subString . 1}}) {{/ifMatches}}{{/eachCommitFixes}}
4848
{{/ifCommitScope}}
4949
{{/ifCommitType}}

src/test/java/se/bjurr/gitchangelog/api/GitChangelogApiTest.testThatOnlyGithubIssuesCanBeParsed.approved.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ Changelog of {{repoName}}.
4242
### Dependency updates
4343

4444
{{#commits}}
45-
{{#ifCommitType . type="feat"}}
46-
{{#ifCommitScope . scope="utils"}}
45+
{{#ifCommitType . type="chore"}}
46+
{{#ifCommitScope . scope="deps"}}
4747
- {{{commitDescription .}}} ([{{subString hash 0 5}}](https://github.com/{{ownerName}}/{{repoName}}/commit/{{hash}}) {{authorName}}) {{#eachCommitRefs .}}{{#ifMatches . "^#[0-9]+"}} [{{.}}](https://github.com/{{ownerName}}/{{repoName}}/issues/{{subString . 1}}) {{/ifMatches}}{{/eachCommitRefs}} {{#eachCommitFixes .}}{{#ifMatches . "^#[0-9]+"}} [{{.}}](https://github.com/{{ownerName}}/{{repoName}}/issues/{{subString . 1}}) {{/ifMatches}}{{/eachCommitFixes}}
4848
{{/ifCommitScope}}
4949
{{/ifCommitType}}

src/test/java/se/bjurr/gitchangelog/api/GitChangelogApiTest.testThatOnlyJiraIssuesCanBeParsed.approved.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ Changelog of {{repoName}}.
4242
### Dependency updates
4343

4444
{{#commits}}
45-
{{#ifCommitType . type="feat"}}
46-
{{#ifCommitScope . scope="utils"}}
45+
{{#ifCommitType . type="chore"}}
46+
{{#ifCommitScope . scope="deps"}}
4747
- {{{commitDescription .}}} ([{{subString hash 0 5}}](https://github.com/{{ownerName}}/{{repoName}}/commit/{{hash}}) {{authorName}}) {{#eachCommitRefs .}}{{#ifMatches . "^#[0-9]+"}} [{{.}}](https://github.com/{{ownerName}}/{{repoName}}/issues/{{subString . 1}}) {{/ifMatches}}{{/eachCommitRefs}} {{#eachCommitFixes .}}{{#ifMatches . "^#[0-9]+"}} [{{.}}](https://github.com/{{ownerName}}/{{repoName}}/issues/{{subString . 1}}) {{/ifMatches}}{{/eachCommitFixes}}
4848
{{/ifCommitScope}}
4949
{{/ifCommitType}}

src/test/java/se/bjurr/gitchangelog/api/GitChangelogApiTest.testThatSecondVersionCanBeGenerated.approved.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ Changelog of {{repoName}}.
4242
### Dependency updates
4343

4444
{{#commits}}
45-
{{#ifCommitType . type="feat"}}
46-
{{#ifCommitScope . scope="utils"}}
45+
{{#ifCommitType . type="chore"}}
46+
{{#ifCommitScope . scope="deps"}}
4747
- {{{commitDescription .}}} ([{{subString hash 0 5}}](https://github.com/{{ownerName}}/{{repoName}}/commit/{{hash}}) {{authorName}}) {{#eachCommitRefs .}}{{#ifMatches . "^#[0-9]+"}} [{{.}}](https://github.com/{{ownerName}}/{{repoName}}/issues/{{subString . 1}}) {{/ifMatches}}{{/eachCommitRefs}} {{#eachCommitFixes .}}{{#ifMatches . "^#[0-9]+"}} [{{.}}](https://github.com/{{ownerName}}/{{repoName}}/issues/{{subString . 1}}) {{/ifMatches}}{{/eachCommitFixes}}
4848
{{/ifCommitScope}}
4949
{{/ifCommitType}}

src/test/java/se/bjurr/gitchangelog/api/TemplatesTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ public void testUrlParts() throws Exception {
124124
ApprovalsWrapper.verify(given);
125125
}
126126

127+
@Test
128+
public void testEachUrlPart() throws Exception {
129+
final GitChangelogApi given =
130+
this.baseBuilder.withTemplatePath("templatetest/testEachUrlPart.mustache");
131+
ApprovalsWrapper.verify(given);
132+
}
133+
127134
@Test
128135
public void testAuthorsCommits() throws Exception {
129136
final GitChangelogApi given =

0 commit comments

Comments
 (0)