Skip to content

Commit

Permalink
### Fix metadata doesn't allow ., -, or _ characters
Browse files Browse the repository at this point in the history
  • Loading branch information
JavierSegoviaCordoba committed Aug 4, 2023
1 parent 96af409 commit 42e450a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

### Fixed

- `metadata` doesn't allow `.`, `-`, or `_` characters

### Updated

- `com.javiersc.hubdle:com.javiersc.hubdle.gradle.plugin -> 0.5.0-beta.6`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ private constructor(

public val dotCommitsHashRegex: Regex = Regex("""(\.$commitsHashRegex)""")

public val metadataRegex: Regex = Regex("""([A-Za-z0-9.]+)""")
public val metadataRegex: Regex = Regex("""([A-Za-z0-9.\-_]+)""")

public val commitsPlusMetadataRegex: Regex = Regex("""(($numRegex)\+($metadataRegex))""")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,17 @@ internal class GradleVersionTest {
metadata shouldBe "DIRTY"
}

with(Version("0.5.0-beta.6.1+1.9.20-dev-5788")) {
major shouldBe 0
minor shouldBe 5
patch shouldBe 0
stage?.name shouldBe "beta"
stage?.num shouldBe 6
commits shouldBe 1
hash.shouldBeNull()
metadata shouldBe "1.9.20-dev-5788"
}

with(Version("1.2.3", "SNAPSHOT")) {
major shouldBe 1
minor shouldBe 2
Expand Down Expand Up @@ -585,6 +596,7 @@ internal class GradleVersionTest {
shouldThrow<GradleVersionException> { Version(1, 2, 3, "alpha3232", 1) }
shouldThrow<GradleVersionException> { Version(1, 2, 3, "232alpha", 1) }
shouldThrow<GradleVersionException> { Version("1.0").copy(stageName = "alpha") }
// TODO: shouldThrow<GradleVersionException> { Version("0.5.0-beta.6.1+.1.9.20-dev-5788") }
}

@Test
Expand Down

0 comments on commit 42e450a

Please sign in to comment.