Last active
December 24, 2015 14:59
-
-
Save fgdrf/6816788 to your computer and use it in GitHub Desktop.
refactoring script for uDIG to move to org.locationtech namespace, copy it into root folder
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
function exec_sed_for_file | |
{ | |
echo $1 $2 $3 | |
prj_list=`find $3 -name "$1" -type f -print` | |
for p in $prj_list | |
do | |
mv $p $p.old | |
sed -e "$2" $p.old > $p | |
rm -rf $p.old | |
done | |
} | |
function change_folder_names | |
{ | |
echo $1 $2 $3 | |
folder_list=`find "$3" -name "$1*" -type d -print` | |
for p in $folder_list | |
do | |
xx=`echo $p | sed -e "s/$2/org\.locationtech\.udig/g"` | |
echo $xx | |
git mv -f $p $xx | |
done | |
} | |
c_path=`pwd` | |
search_string=`echo $1 | sed -e 's/\./\\\./g'` | |
sed_command="s/$search_string/org\.locationtech\.udig/g" | |
mvn_id_search_string=`echo $search_string | sed -e 's/\\\.udig//g'` | |
mvn_id_change_command="s/>$mvn_id_search_string</>org\.locationtech</g" | |
#change folder names | |
change_folder_names $1 "$search_string" "$c_path/features" | |
change_folder_names $1 "$search_string" "$c_path/plugins" | |
change_folder_names $1 "$search_string" "$c_path/extras" | |
#replace file content | |
exec_sed_for_file .project "$sed_command" "$c_path" | |
exec_sed_for_file pom.xml "$sed_command" "$c_path" | |
exec_sed_for_file pom.xml "$mvn_id_change_command" "$c_path" | |
exec_sed_for_file feature.xml "$sed_command" "$c_path/features" | |
exec_sed_for_file MANIFEST.MF "$sed_command" "$c_path/plugins" | |
exec_sed_for_file MANIFEST.MF "$sed_command" "$c_path/extras" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
execute the script with the path (e.g. net.refractions.udig) you like to replace with "org.locationtech.udig":