Skip to content

Commit

Permalink
Merge pull request #8 from huygun/feature/redmine
Browse files Browse the repository at this point in the history
feat: Redmine Support
  • Loading branch information
tomasbjerre authored Nov 16, 2021
2 parents 4c94679 + 8c08aaf commit 7682893
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,27 @@ Or from command line:
-ri, --remove-issue-from-message Dont print any issues in the
messages of commits.
Default: disabled
-rmp, --redmine-pattern <string> Redmine issue pattern.
<string>: any string
Default: #([0-9]+)
-rmpw, --redmine-password <string> Optional password to
authenticate with Redmine.
<string>: any string
Default:
-rms, --redmine-server <string> Redmine server. When a Redmine
server is given, the title of the
Redmine issues can be used in the
changelog.
<string>: any string
Default: null
-rmt, --redmine-token <string> Optional token/api-key to
authenticate with Redmine.
<string>: any string
Default:
-rmu, --redmine-username <string> Optional username to
authenticate with Redmine.
<string>: any string
Default:
-rt, --readable-tag-name <string> Pattern to extract readable
part of tag.
<string>: any string
Expand Down
49 changes: 49 additions & 0 deletions src/main/java/se/bjurr/gitchangelog/main/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public class Main {
public static final String PARAM_JIRA_USERNAME = "-ju";
public static final String PARAM_JIRA_PASSWORD = "-jpw";
public static final String PARAM_JIRA_BASIC_AUTH = "-jba";
public static final String PARAM_REDMINE_SERVER = "-rms";
public static final String PARAM_REDMINE_ISSUE_PATTERN = "-rmp";
public static final String PARAM_REDMINE_USERNAME = "-rmu";
public static final String PARAM_REDMINE_PASSWORD = "-rmpw";
public static final String PARAM_REDMINE_TOKEN = "-rmt";
public static final String PARAM_CUSTOM_ISSUE_NAME = "-cn";
public static final String PARAM_CUSTOM_ISSUE_PATTERN = "-cp";
public static final String PARAM_CUSTOM_ISSUE_LINK = "-cl";
Expand Down Expand Up @@ -177,6 +182,30 @@ public static void main(final String args[]) throws Exception {
.defaultValue(defaultSettings.getJiraIssuePattern()) //
.build();

final Argument<String> redmineServerArgument =
stringArgument(PARAM_REDMINE_SERVER, "--redmine-server") //
.description(
"Redmine server. When a Redmine server is given, the title of the Redmine issues can be used in the changelog.") //
.defaultValue(defaultSettings.getRedmineServer().orElse(null)) //
.build();
final Argument<String> redmineIssuePatternArgument =
stringArgument(PARAM_REDMINE_ISSUE_PATTERN, "--redmine-pattern") //
.description("Redmine issue pattern.") //
.defaultValue(defaultSettings.getRedmineIssuePattern()) //
.build();
final Argument<String> redmineUsernameArgument =
stringArgument(PARAM_REDMINE_USERNAME, "--redmine-username") //
.description("Optional username to authenticate with Redmine.") //
.build();
final Argument<String> redminePasswordArgument =
stringArgument(PARAM_REDMINE_PASSWORD, "--redmine-password") //
.description("Optional password to authenticate with Redmine.") //
.build();
final Argument<String> redmineTokenArgument =
stringArgument(PARAM_REDMINE_TOKEN, "--redmine-token") //
.description("Optional token/api-key to authenticate with Redmine.") //
.build();

final Argument<String> customIssueNameArgument =
stringArgument(PARAM_CUSTOM_ISSUE_NAME, "--custom-issue-name") //
.description("Custom issue name.") //
Expand Down Expand Up @@ -358,6 +387,8 @@ public static void main(final String args[]) throws Exception {
untaggedTagNameArgument,
jiraIssuePatternArgument,
jiraServerArgument,
redmineIssuePatternArgument,
redmineServerArgument,
ignoreCommitsIfMessageMatchesArgument,
ignoreCommitsOlderThanArgument,
customIssueLinkArgument,
Expand All @@ -373,6 +404,9 @@ public static void main(final String args[]) throws Exception {
jiraUsernamePatternArgument,
jiraPasswordPatternArgument,
jiraBasicAuthStringPatternArgument,
redmineUsernameArgument,
redminePasswordArgument,
redmineTokenArgument,
extendedVariablesArgument,
extendedHeadersArgument,
templateContentArgument,
Expand Down Expand Up @@ -475,6 +509,21 @@ public static void main(final String args[]) throws Exception {
if (arg.wasGiven(jiraBasicAuthStringPatternArgument)) {
changelogApiBuilder.withJiraBasicAuthString(arg.get(jiraBasicAuthStringPatternArgument));
}
if (arg.wasGiven(redmineIssuePatternArgument)) {
changelogApiBuilder.withRedmineIssuePattern(arg.get(redmineIssuePatternArgument));
}
if (arg.wasGiven(redmineServerArgument)) {
changelogApiBuilder.withRedmineServer(arg.get(redmineServerArgument));
}
if (arg.wasGiven(redmineUsernameArgument)) {
changelogApiBuilder.withRedmineUsername(arg.get(redmineUsernameArgument));
}
if (arg.wasGiven(redminePasswordArgument)) {
changelogApiBuilder.withRedminePassword(arg.get(redminePasswordArgument));
}
if (arg.wasGiven(redmineTokenArgument)) {
changelogApiBuilder.withRedmineToken(arg.get(redmineTokenArgument));
}
if (arg.wasGiven(timeZoneArgument)) {
changelogApiBuilder.withTimeZone(arg.get(timeZoneArgument));
}
Expand Down

0 comments on commit 7682893

Please sign in to comment.