Skip to content

Commit

Permalink
Require a v in the version number.
Browse files Browse the repository at this point in the history
  • Loading branch information
fasaxc committed Jun 1, 2017
1 parent c73c456 commit e55ced8
Showing 1 changed file with 12 additions and 39 deletions.
51 changes: 12 additions & 39 deletions utils/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function validate_version {
version=$1

# We allow.
REGEX="^[0-9]+\.[0-9]+\.[0-9]+(-?(a|b|rc|pre).*)?$"
REGEX="^v[0-9]+\.[0-9]+\.[0-9]+(-?(a|b|rc|pre).*)?$"

if [[ $version =~ $REGEX ]]; then
return 0
Expand All @@ -75,45 +75,18 @@ function test_validate_version {
}

# Test cases.
expect_valid 1.2.3
expect_invalid 1.2.3.4
expect_invalid .2.3.4
expect_valid v1.2.3
expect_invalid v1.2.3.4
expect_invalid v.2.3.4
expect_invalid abc
expect_invalid 1.2.3.beta
expect_valid 1.2.3-beta.2
expect_valid 1.2.3-beta
expect_valid 1.2.3-alpha
expect_valid 1.2.3-rc2
expect_invalid 1:2.3-rc2
expect_invalid 1.2:3-rc2
expect_invalid 1.2.3:rc2

# All Felix tags since 1.0.0:
expect_valid 1.0.0
expect_valid 1.1.0
expect_valid 1.2.0
expect_valid 1.2.0-pre2
expect_valid 1.2.1
expect_valid 1.2.2
expect_valid 1.3.0
expect_valid 1.3.0-pre5
expect_valid 1.3.0a5
expect_valid 1.3.0a6
expect_valid 1.3.1
expect_valid 1.4.0
expect_valid 1.4.0b1
expect_valid 1.4.0b2
expect_valid 1.4.0b3
expect_valid 1.4.1b1
expect_valid 1.4.1b2
expect_valid 1.4.2
expect_valid 1.4.3
expect_valid 1.4.4
expect_valid 2.0.0-beta
expect_valid 2.0.0-beta-rc2
expect_valid 2.0.0-beta.2
expect_valid 2.0.0-beta.3
expect_invalid v2.0.0-beta-rc1
expect_invalid v1.2.3.beta
expect_valid v1.2.3-beta.2
expect_valid v1.2.3-beta
expect_valid v1.2.3-alpha
expect_valid v1.2.3-rc2
expect_invalid v1:2.3-rc2
expect_invalid v1.2:3-rc2
expect_invalid v1.2.3:rc2
}

# Return the series of tags from HEAD back to (but excluding) the
Expand Down

0 comments on commit e55ced8

Please sign in to comment.