Skip to content

Commit

Permalink
Accept custom directories in the bump script (kanisterio#734)
Browse files Browse the repository at this point in the history
* Accept custom directories in the bump script.

* To grep the version (0.35.0) we used the regex using -E flag
that means . would imply to any character and that was the
reason we were seeing some unexpected behaviour.
This changes the flag to -F that matches the exact word.

* Improve comment

Co-authored-by: Vivek Singh <vsingh.ggits.2010@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 17, 2020
1 parent 06f624a commit 95699dc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions build/bump_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@ usage() {
}

main() {
local prev=${1:?"$(usage)"}
local next=${2:?"$(usage)"}
local -a pkgs=(docker/ scripts/ examples/ pkg/ helm/)
grep -E "${prev}" -r "${pkgs[@]}" | cut -d ':' -f 1 | uniq | xargs sed -ri "s/${prev}/${next//./\\.}/g"
local prev=${1:?"$(usage)"}; shift
local next=${1:?"$(usage)"}; shift
if [ "$#" -eq 0 ]; then
pkgs=( docker/ scripts/ examples/ pkg/ helm/ )
else
pkgs=( "$@" )
fi
# -F matches for exact words, not regular expression (-E), that is what required here
grep -F "${prev}" -r "${pkgs[@]}" | cut -d ':' -f 1 | uniq | xargs sed -ri "s/${prev}/${next//./\\.}/g"
}

main $@
Expand Down

0 comments on commit 95699dc

Please sign in to comment.