Created
December 29, 2011 01:22
-
-
Save Kalisen/1530977 to your computer and use it in GitHub Desktop.
list/upgrade plugin's version across all projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
PLUGIN_NAME=$1 | |
PLUGIN_VERSION=$2 | |
if [ -z "$1" -o "$1" = "-h" ] | |
then | |
echo Usage: | |
echo List usage of a plugin: | |
echo up_plugin PLUGIN_NAME | |
echo | |
echo Update plugin version: | |
echo up_plugin PLUGIN_NAME NEW_PLUGIN_VERSION | |
exit 1 | |
fi | |
if [ -z "$2" ] | |
then | |
ACTION="LIST" | |
else | |
ACTION="UPGRADE" | |
fi | |
if [ "$ACTION" = "LIST" ] | |
then | |
echo "listing $PLUGIN_NAME plugin usages." | |
grep -RnH --include "BuildConfig.groovy" :$PLUGIN_NAME: * | |
else | |
CONFIG_FILES=$(grep -RnH --include "BuildConfig.groovy" :$PLUGIN_NAME: * | cut -d : -f 1) | |
echo "upgrading $PLUGIN_NAME plugin to version $PLUGIN_VERSION." | |
for file in $CONFIG_FILES | |
do | |
echo "processing file $file" | |
cp $file $file.old | |
cat $file.old | sed -E "s/:$PLUGIN_NAME:([0-9\.]*)(['\"])/:$PLUGIN_NAME:$PLUGIN_VERSION\2/g" > $file | |
rm $file.old | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
running
up_plugin my-plugin 10.0
will update any BuildConfig.groovy file in any subdirectory of the current directory
and change the dependency version for 'my-plugin' to 10.0