Skip to content
Snippets Groups Projects
Commit 44fa8c11 authored by colemanw's avatar colemanw
Browse files

Improve "update" mode in releaser to escape regex and show diff

parent 452c9185
No related branches found
No related tags found
No related merge requests found
...@@ -167,17 +167,32 @@ function do_publish() { ...@@ -167,17 +167,32 @@ function do_publish() {
################################################# #################################################
## Update Version Info ## Update Version Info
function do_update() { function do_update() {
echo "VERSION UPDATE: Please enter the version that comes after $version" echo "VERSION UPDATE: Enter the version that comes after $version (or enter nothing to abort)"
read new_ver read new_ver
if [ -n "$new_ver" ]; then if [ -n "$new_ver" ]; then
cd $workdir/$version/export cd $workdir/$version/export
# escape regex special chars
arg=`echo "$version" | sed 's:[]\[\^\$\.\*\/]:\\\\&:g'`
for file in xml/version.xml sql/civicrm_generated.mysql; do for file in xml/version.xml sql/civicrm_generated.mysql; do
sed "s/$version/$new_ver/g" < $file > $file.tmp set -ex
git checkout $file
sed "s/$arg/$new_ver/" < $file > $file.tmp
mv $file.tmp $file mv $file.tmp $file
git add $file set +x
done done
git commit -m "Update version to $new_ver" # print the diff directly to the screen
git push origin "$start_point" git diff | cat
echo "Push these changes? y/n"
read input
if [ "$input" = "y" ]; then
set -ex
git add xml/version.xml sql/civicrm_generated.mysql
git commit -m "Update version to $new_ver"
git push origin "$start_point"
set +x
else
do_update
fi
else else
echo "No version entered. Aborting version update." echo "No version entered. Aborting version update."
fi fi
...@@ -214,9 +229,8 @@ for ACT in "$@" ; do ...@@ -214,9 +229,8 @@ for ACT in "$@" ; do
set +x set +x
;; ;;
--update) --update)
set -ex
do_update
set +x set +x
do_update
;; ;;
--clean) --clean)
set -ex set -ex
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment