Commit 5c56bd1a authored by Nils Goroll's avatar Nils Goroll

save vmod developer life time

by providing a trivial tool to rename vmod RST references.

To @Dridi and all other ladybug-lovers: I tried, but gave up after 5'.
Maybe spatch on its own would have done the job, but sed is just so much
simpler and, IMHO, totally appropriate for the job.
parent bdf0c9f5
......@@ -86,6 +86,8 @@ APIs / VMODs
:ref:`name.obj()`
:ref:`xobj.method()`
``tools/vmod_ref_rename.sh`` is provided to automate this task
================================
Varnish Cache 6.2.0 (2019-03-15)
================================
......
#!/bin/bash
# trivial sed-based tool to rename RST references in vmod .vcc files
# to the new scheme as of commit
# 904ceabf07c294983efcebfe1d614c2d2fd5cdda
#
# only tested with GNU sed
#
# to be called from a vmod git repository
#
# Author: Nils Goroll <nils.goroll@uplex.de>
#
# This file is in the public domain
typeset -ra files=($(git ls-files | grep -E '\.vcc$'))
if [[ ${#files[@]} -eq 0 ]] ; then
echo >&2 'No vcc files found'
exit 0
fi
if [[ -n $(git status -s) ]] ; then
echo >&2 'clean up your tree first'
git status
exit 1
fi
set -eu
sed -e 's#`vmod_\([^.]*\)\.\([^.`]*\)`_#`\1.\2()`_#g' \
-e 's#`vmod_\([^.]*\)\.\([^.`]*\).\([^.`]*\)`_#`x\2.\3()`_#g' \
-i "${files[@]}"
if [[ -z $(git status -s) ]] ; then
echo >&2 'no change'
exit 0
fi
git commit -m 'rename vmod RST references (vmod_ref_rename.sh)' \
"${files[@]}"
echo DONE - review and test the previous commit
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment