Commit dd246222 authored by Lasse Karstensen's avatar Lasse Karstensen

Add a renaming script.

This is useful for changing all references of libvmod-example/example
into your new vmod name.

One-off task for all vmods, but if you write more than a couple you
quickly get fed up with this drudgery.
parent ece6c6e5
#!/bin/bash
#
# Script to rename libvmod-example into libvmod-foo.
# (where "foo" is your new vmod name, of course.)
#
# Leaves the changes uncommitted in the working tree, so you get to fix any
# unintended changes.
#
# Author: Lasse Karstensen <lkarsten@varnish-software.com>, September 2014.
#
set -o errexit
NAME=$1
if [ -z "$NAME" ]; then
echo "Usage: $0 <new-vmod-name-without-libvmod-prefix>"
echo "Rename libvmod-example source tree."
echo
exit -1
fi
if ! git diff-index --quiet HEAD --; then
echo "ERROR: Need a clean working tree. Run \"git stash\" first."
exit -2
fi
git mv src/vmod_example.c src/vmod_${NAME}.c
git mv src/vmod_example.vcc src/vmod_${NAME}.vcc
git mv vmod-example.spec vmod-${NAME}.spec
git grep -z -l example | xargs -0 sed -i -s -e "s/example/${NAME}/g"
echo "All done."
echo -e "For your cut&paste needs:\n git commit -a -m 'Automatic rename of libvmod-example to libvmod-tcp.'"
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