@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user