Skip to content

Commit 471c98f

Browse files
committed
THX-1198: Deprecate m some more.
1 parent 4fb63a7 commit 471c98f

File tree

2 files changed

+14
-24
lines changed

2 files changed

+14
-24
lines changed

scripts/detectNewVersion.sh

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ NAME
2929
${0##*/}
3030
3131
SYNOPSIS
32-
${0##*/} [-hv]
32+
${0##*/} [-hefpnd]
3333
3434
DESCRIPTION
3535
Detects the new version for the repository by analyzing the gitflow branch history since the
@@ -47,10 +47,9 @@ DESCRIPTION
4747
-p Increments PATCH version on _every_ run.
4848
WARN: This is intended development use only.
4949
50-
-m Enables mono-repo mode, allowing matching against semvers prefixed with
51-
a product name. Eg: 'cool-app_1.2.3'
52-
53-
-n The product name to match against. EG: 'bob' would match tags like 'bob_1.2.3'.
50+
-n Enables mono-repo mode allowing the product name to match against tags.
51+
EG: 'bob' would match tags like 'bob_1.2.3'.
52+
TIP: dir names and product names should match. This arg exists in case they do not.
5453
5554
-d The directory of the product to version. EG: 'path/to/bob'.
5655
@@ -82,7 +81,7 @@ fi
8281
# --------------------------------------------------------------------------------------------------
8382

8483
OPTIND=1
85-
while getopts "he:vfpmn:d:" opt; do
84+
while getopts "he:vfpn:d:" opt; do
8685
case $opt in
8786
h)
8887
printHelp
@@ -102,10 +101,6 @@ while getopts "he:vfpmn:d:" opt; do
102101
p)
103102
arg_p='set'
104103
;;
105-
m)
106-
arg_m='set'
107-
arg_opts="$arg_opts -m"
108-
;;
109104
n)
110105
arg_n='set'
111106
arg_n_val="$OPTARG"
@@ -267,4 +262,4 @@ if [[ -n $arg_e ]]; then
267262
export export_var
268263
else
269264
echo "$newVersion"
270-
fi
265+
fi

scripts/validateSemver.sh

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ NAME
1515
validateSemver.sh
1616
1717
SYNOPSIS
18-
${0##*/} [-hpv9] <version>
18+
${0##*/} [-hpv9nd] <version>
1919
2020
DESCRIPTION
2121
Validates the schema of a provided version string against the semantic versioning standard.
@@ -48,10 +48,9 @@ DESCRIPTION
4848
4949
(v)[Major].[Minor].[Patch]
5050
51-
-m Enables mono-repo mode, allowing matching against semvers prefixed with
52-
a product name. Eg: 'cool-app_1.2.3'
53-
54-
-n The product name to match against. EG: 'bob' would match tags like 'bob_1.2.3'.
51+
-n Enables mono-repo mode allowing the product name to match against tags.
52+
EG: 'bob' would match tags like 'bob_1.2.3'.
53+
TIP: dir names and product names should match. This arg exists in case they do not.
5554
5655
-d The directory of the product to version. EG: 'path/to/bob'.
5756
@@ -87,7 +86,7 @@ fi
8786
# --------------------------------------------------------------------------------------------------
8887

8988
OPTIND=1
90-
while getopts "hp:v9mn:d:" opt; do
89+
while getopts "hp:v9n:d:" opt; do
9190
case $opt in
9291
h)
9392
printHelp
@@ -103,10 +102,6 @@ while getopts "hp:v9mn:d:" opt; do
103102
9)
104103
arg_9='set'
105104
;;
106-
m)
107-
arg_m='set'
108-
arg_opts="$arg_opts -m"
109-
;;
110105
n)
111106
arg_n='set'
112107
arg_n_val="$OPTARG"
@@ -135,10 +130,10 @@ tsCmd='date --utc +%FT%T.%3NZ'
135130

136131
if [[ -n $arg_9 ]]; then
137132
semverRegex="^[v]?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
138-
[[ -n $arg_m ]] && semverRegex="([0-9A-Za-z]+)?[_-]?[v]?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
133+
[[ -n $arg_d ]] && semverRegex="([0-9A-Za-z]+)?[_-]?[v]?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
139134
else
140135
semverRegex="^[v]?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-([0-9A-Za-z]+))?(\\+((([1-9])|([1-9][0-9]+))))?$"
141-
[[ -n $arg_m ]] && semverRegex="^([0-9A-Za-z]+)?[_-]?[v]?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-([0-9A-Za-z]+))?(\\+((([1-9])|([1-9][0-9]+))))?$"
136+
[[ -n $arg_d ]] && semverRegex="^([0-9A-Za-z]+)?[_-]?[v]?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-([0-9A-Za-z]+))?(\\+((([1-9])|([1-9][0-9]+))))?$"
142137
fi
143138

144139
# --------------------------------------------------------------------------------------------------
@@ -175,7 +170,7 @@ function validateSemver {
175170
else
176171
[[ -z $arg_9 && -n $arg_v ]] && echo -e "[$(${tsCmd})] \e[01;31mFATAL\e[00m: '$version' does not match the semver schema: '(v)[Major].[Minor].[Patch](-PRERELEASE)(+BUILD)'!\n"
177172
[[ -n $arg_9 && -n $arg_v ]] && echo -e "[$(${tsCmd})] \e[01;31mFATAL\e[00m: '$version' does not match the semver schema: '(v)[Major].[Minor].[Patch]'!\n"
178-
[[ -n $arg_9 && -n $arg_v && -n $arg_m ]] && echo -e "[$(${tsCmd})] \e[01;31mFATAL\e[00m: '$version' does not match the semver schema: '[product_name][-_](v)[Major].[Minor].[Patch]'!\n"
173+
[[ -n $arg_9 && -n $arg_v && -n $arg_d ]] && echo -e "[$(${tsCmd})] \e[01;31mFATAL\e[00m: '$version' does not match the semver schema: '[product_name][-_](v)[Major].[Minor].[Patch]'!\n"
179174
exit 1
180175
fi
181176
}

0 commit comments

Comments
 (0)