Added support for RC / Milestone

fixes #8
This commit is contained in:
Marcin Grzejszczak
2017-03-16 14:41:20 +01:00
parent e2d430ab74
commit 01e8f2401c
280 changed files with 725 additions and 105 deletions

View File

@@ -56,9 +56,13 @@ public class Releaser {
public void rollbackReleaseVersion(File project, ProjectVersion originalVersion, ProjectVersion changedVersion) {
this.projectGitUpdater.revertChangesIfApplicable(project, changedVersion);
this.projectBuilder.bumpVersions(originalVersion.bumpedVersion());
this.projectGitUpdater.commitAfterBumpingVersions(project, originalVersion);
log.info("\nSuccessfully reverted the commit and bumped snapshot versions");
if (changedVersion.isRelease()) {
this.projectBuilder.bumpVersions(originalVersion.bumpedVersion());
this.projectGitUpdater.commitAfterBumpingVersions(project, originalVersion);
log.info("\nSuccessfully reverted the commit and bumped snapshot versions");
} else {
log.info("\nSuccessfully reverted the commit and came back to snapshot versions");
}
}
public void pushCurrentBranch(File project) {

View File

@@ -49,6 +49,10 @@ public class ProjectVersion {
return this.version.contains("SNAPSHOT");
}
public boolean isRelease() {
return this.version.contains("RELEASE");
}
@Override public String toString() {
return this.version;
}

View File

@@ -89,6 +89,27 @@ public class ProjectVersionTests {
then(projectVersion(version).isSnapshot()).isFalse();
}
@Test
public void should_return_false_for_milestone_version() {
String version = "1.0.1.M1";
then(projectVersion(version).isRelease()).isFalse();
}
@Test
public void should_return_false_for_rc_version() {
String version = "1.0.1.RC1";
then(projectVersion(version).isRelease()).isFalse();
}
@Test
public void should_return_true_for_release_versions() {
String version = "1.0.1.RELEASE";
then(projectVersion(version).isRelease()).isTrue();
}
private ProjectVersion projectVersion(String version) {
return new ProjectVersion("foo", version);
}