Author: jbalunas(a)redhat.com
Date: 2010-05-25 18:58:22 -0400 (Tue, 25 May 2010)
New Revision: 17241
Added:
root/build/resources/trunk/change_version.sh
Log:
Script to change all pom.xml versions from ORIG to NEW, using basic perl script
Added: root/build/resources/trunk/change_version.sh
===================================================================
--- root/build/resources/trunk/change_version.sh (rev 0)
+++ root/build/resources/trunk/change_version.sh 2010-05-25 22:58:22 UTC (rev 17241)
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+usage()
+{
+cat << EOF
+usage: $0 options
+
+This script will search all pom.xml and change <version>ORIG</version> to
<version>NEW</version>
+
+BASIC OPTIONS:
+ -h Show this message
+ -d Destination directory, otherwise the PWD is used
+ -o Version to replace - such as 4-SNAPSHOT
+ -n Version to replace with - such as 5
+EOF
+}
+
+work()
+{
+
+if [ -d "$DESTINATION" ]
+then
+ echo "Beginning version update from base directory: $DESTINATION"
+else
+ echo "Base directory does not exist, can not update version from:
$DESTINATION"
+ exit 1;
+fi
+
+ echo
+ echo =================================
+ echo "Changing <version>$ORIG_VERSION</version> into
<version>$NEW_VERSION</version>
+
+ find . -name "pom.xml" | xargs perl -pi -e
"s/<version>$ORIG_VERSION<\/version>/<version>$NEW_VERSION<\/version>/"
+
+ echo =================================
+
+done
+
+}
+
+DESTINATION=`pwd`
+ORIG_VERSION=
+NEW_VERSION=
+
+while getopts "n:o:d:h" OPTION
+do
+ case $OPTION in
+ n)
+ NEW_VERSION=$OPTARG
+ ;;
+ o)
+ ORIG_VERSION=$OPTARG
+ ;;
+ d)
+ DESTINATION=$OPTARG
+ ;;
+ h)
+ usage
+ WORK=0
+ ;;
+ [?])
+ usage;
+ WORK=0
+ ;;
+ esac
+done
+
+if [ "$WORK" -eq "1" ] || [ "$#" -eq "0" ]
+then
+ work;
+fi
\ No newline at end of file
Property changes on: root/build/resources/trunk/change_version.sh
___________________________________________________________________
Name: svn:executable
+ *
Show replies by date