forked from yegor256/rultor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yegor256#960 removed handling of no tag given in release command from…
… this PR, this is not in the scope of the issue.
- Loading branch information
1 parent
fb18b8b
commit e7b8a16
Showing
3 changed files
with
59 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,8 +60,7 @@ public final class QnRelease implements Question { | |
/** | ||
* Pattern matching the version tag of the release enclosed by backticks. | ||
*/ | ||
private static final Pattern QUESTION_PATTERN = | ||
Pattern.compile("`(.+)`"); | ||
private static final Pattern QUESTION_PATTERN = Pattern.compile("`(.+)`"); | ||
|
||
/** | ||
* Message bundle. | ||
|
@@ -84,25 +83,7 @@ public Req understand(final Comment.Smart comment, | |
final String name = matcher.group(1); | ||
final ReleaseTag release = new ReleaseTag(issue.repo(), name); | ||
if (release.allowed()) { | ||
new Answer(comment).post( | ||
true, | ||
String.format( | ||
QnRelease.PHRASES.getString("QnRelease.start"), | ||
home.toASCIIString() | ||
) | ||
); | ||
req = new Req.Simple( | ||
"release", | ||
new ImmutableMap.Builder<String, String>() | ||
.put("head_branch", "master") | ||
.put( | ||
"head", | ||
String.format( | ||
"[email protected]:%s.git", | ||
comment.issue().repo().coordinates() | ||
) | ||
).build() | ||
); | ||
req = QnRelease.affirmative(comment, home); | ||
} else { | ||
new Answer(comment).post( | ||
false, | ||
|
@@ -115,13 +96,39 @@ public Req understand(final Comment.Smart comment, | |
req = Req.EMPTY; | ||
} | ||
} else { | ||
new Answer(comment).post( | ||
false, | ||
QnRelease.PHRASES.getString("QnRelease.missing-tag") | ||
); | ||
req = Req.EMPTY; | ||
req = QnRelease.affirmative(comment, home); | ||
} | ||
return req; | ||
} | ||
|
||
/** | ||
* Confirms that Rultor is starting the release process. | ||
* @param comment Comment that triggered the release | ||
* @param home URI of the release tail | ||
* @return Req.Simple containing the release parameters | ||
* @throws IOException on error | ||
*/ | ||
private static Req affirmative(final Comment.Smart comment, | ||
final URI home) throws IOException { | ||
new Answer(comment).post( | ||
true, | ||
String.format( | ||
QnRelease.PHRASES.getString("QnRelease.start"), | ||
home.toASCIIString() | ||
) | ||
); | ||
return new Req.Simple( | ||
"release", | ||
new ImmutableMap.Builder<String, String>() | ||
.put("head_branch", "master") | ||
.put( | ||
"head", | ||
String.format( | ||
"[email protected]:%s.git", | ||
comment.issue().repo().coordinates() | ||
) | ||
).build() | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters