Skip to content

Instantly share code, notes, and snippets.

@fgdrf
Last active December 24, 2015 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fgdrf/6816788 to your computer and use it in GitHub Desktop.
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
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"
@fgdrf
Copy link
Author

fgdrf commented Oct 3, 2013

execute the script with the path (e.g. net.refractions.udig) you like to replace with "org.locationtech.udig":

. change_project.sh eu.udig
. change_project.sh org.tcat.citd.sim.udig
. change_project.sh net.refractions.udig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment