Skip to content

Commit

Permalink
Rename patch version type as hotfix, inline with MDTP versioning stra…
Browse files Browse the repository at this point in the history
…tegy
  • Loading branch information
Steve Smith committed Dec 2, 2015
1 parent 3a6fc69 commit 4b9c106
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/uk/gov/hmrc/releaser/ArgParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object ArgParser{
case class Config(
artefactName: String = "",
rcVersion:String = "",
releaseType:ReleaseType.Value = ReleaseType.PATCH,
releaseType:ReleaseType.Value = ReleaseType.HOTFIX,
githubNameOverride:Option[String] = None,
tag:Boolean = true,
verbose:Boolean = false,
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/uk/gov/hmrc/releaser/Releaser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ object ReleaserMain {

object ReleaseType extends Enumeration {
type ReleaseType = Value
val MAJOR, MINOR, PATCH = Value
val MAJOR, MINOR, HOTFIX = Value

val stringValues: SortedSet[String] = this.values.map(_.toString)
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/uk/gov/hmrc/releaser/domain/Versions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ object VersionNumberCalculator{

def calculateTarget(rcVersion:ReleaseCandidateVersion, releaseType: ReleaseType.Value): Try[ReleaseVersion] = Try {
groups(rcVersion.value).toList.map(_.toInt) match {
case List(major, minor, patch) => releaseType match {
case ReleaseType.PATCH => ReleaseVersion(major, minor, patch + 1)
case List(major, minor, hotfix) => releaseType match {
case ReleaseType.HOTFIX => ReleaseVersion(major, minor, hotfix + 1)
case ReleaseType.MINOR => ReleaseVersion(major, minor+1, 0)
case ReleaseType.MAJOR => ReleaseVersion(major+1, 0, 0)
}
Expand Down
8 changes: 4 additions & 4 deletions src/test/scala/uk/gov/hmrc/releaser/CoordinatorSpecs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CoordinatorSpecs extends WordSpec with Matchers with OptionValues with Try

"the coordinator" should {

"release version 0.9.9 of a library with an assembly, not modifying the assembly manifest, when given the inputs 'time', '1.3.0-1-g21312cc' and 'patch' as the artefact, release candidate and release type" in {
"release version 0.9.9 of a library with an assembly, not modifying the assembly manifest, when given the inputs 'time', '1.3.0-1-g21312cc' and 'hotfix' as the artefact, release candidate and release type" in {

val fakeRepoConnector = Builders.buildConnector(
"",
Expand Down Expand Up @@ -79,7 +79,7 @@ class CoordinatorSpecs extends WordSpec with Matchers with OptionValues with Try
pomVersionText shouldBe "0.9.9"
}

"release version 2.0.0 of a maven-based service when given the inputs 'help-frontend', '1.26.0-3-gd7ed03c' and 'patch' as the artefact, release candidate and release type" in {
"release version 2.0.0 of a maven-based service when given the inputs 'help-frontend', '1.26.0-3-gd7ed03c' and 'hotfix' as the artefact, release candidate and release type" in {

val fakeRepoConnector = Builders.buildConnector(
"",
Expand Down Expand Up @@ -126,7 +126,7 @@ class CoordinatorSpecs extends WordSpec with Matchers with OptionValues with Try
pomVersionText shouldBe "0.9.9"
}

"release version 0.9.9 of a maven-based library when given the inputs 'time', '1.3.0-1-g21312cc' and 'patch' as the artefact, release candidate and release type" in {
"release version 0.9.9 of a maven-based library when given the inputs 'time', '1.3.0-1-g21312cc' and 'hotfix' as the artefact, release candidate and release type" in {

val fakeRepoConnector = Builders.buildConnector(
"",
Expand Down Expand Up @@ -192,7 +192,7 @@ class CoordinatorSpecs extends WordSpec with Matchers with OptionValues with Try
}
}

"release version 0.1.1 of an ivy-based SBT plugin when given the inputs 'sbt-bobby', '0.8.1-4-ge733d26' and 'patch' as the artefact, release candidate and release type" in {
"release version 0.1.1 of an ivy-based SBT plugin when given the inputs 'sbt-bobby', '0.8.1-4-ge733d26' and 'hotfix' as the artefact, release candidate and release type" in {

val githubReleaseBuilder = new MockFunction2[ArtefactMetaData, VersionMapping]()
val githubTagObjBuilder = new MockFunction3[Repo, ReleaseVersion, CommitSha, CommitSha]()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class VersionNumberCalculatorSpec extends WordSpec with Matchers with TryValues
import VersionNumberCalculator._

"VersionNumberCalculator" should {
"calculate 0.8.2 given a release candidate of 0.8.1-4-ge733d26 and release type of PATCH" in {
calculateTarget(ReleaseCandidateVersion("0.8.1-4-ge733d26"), ReleaseType.PATCH).success.value.value shouldBe "0.8.2"
"calculate 0.8.2 given a release candidate of 0.8.1-4-ge733d26 and release type of HOTFIX" in {
calculateTarget(ReleaseCandidateVersion("0.8.1-4-ge733d26"), ReleaseType.HOTFIX).success.value.value shouldBe "0.8.2"
}

"calculate 0.9.0 given a release candidate of 0.8.1-4-ge733d26 and release type of MINOR" in {
Expand All @@ -37,11 +37,11 @@ class VersionNumberCalculatorSpec extends WordSpec with Matchers with TryValues
}

"calculate 11.12.20 given a release candidate of 11.12.19-4-ge733d26 and release type of MAJOR" in {
calculateTarget(ReleaseCandidateVersion("11.12.19-4-ge733d26"), ReleaseType.PATCH).success.value.value shouldBe "11.12.20"
calculateTarget(ReleaseCandidateVersion("11.12.19-4-ge733d26"), ReleaseType.HOTFIX).success.value.value shouldBe "11.12.20"
}

"return a failure given an invalid release number of 0.0.1-SNAPSHOT and release type of PATCH" in {
calculateTarget(ReleaseCandidateVersion("0.0.1-SNAPSHOT"), ReleaseType.PATCH).failure.exception.getMessage should include("SNAPSHOT")
calculateTarget(ReleaseCandidateVersion("0.0.1-SNAPSHOT"), ReleaseType.HOTFIX).failure.exception.getMessage should include("SNAPSHOT")
}
}
}

0 comments on commit 4b9c106

Please sign in to comment.