generated from feelpp/feelpp-project
-
Notifications
You must be signed in to change notification settings - Fork 2
/
rename.sh
54 lines (44 loc) · 1.71 KB
/
rename.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#! /bin/bash
in_default_projectname="project"
read -p "What is the name of the project ? [$in_default_projectname]: " projectname
projectname=${projectname:-$in_default_projectname}
in_default_titlename="$projectname"
read -p "What is the title of the project? [$in_default_titlename]" projecttitle
projecttitle=${projecttitle:-$in_default_titlename}
in_default_shortname="p"
read -p "What is the short name of the project? []" shortprojectname
shortprojectname=${shortprojectname:-$in_default_shortname}
in_default_appname="myapp"
read -p "What is the name of the first application? [$in_default_appname]" appname
appname=${appname:-$in_default_appname}
echo " project name: $projectname"
echo " project title: $projecttitle"
echo "project shortname: $shortprojectname"
echo " app name: $appname"
PS3="Do you wish to rename this project?"
select yn in Yes No
do
case $yn in
Yes ) echo "Ok lets go!"; break;;
No ) exit;;
esac
done
export projectname
export projecttitle
export shortprojectname
export appname
files=( "README.adoc" "CMakeFiles.txt" "src/CMakeLists.txt" "src/.tests.myapp"
"site-dev.yml" "docs/antora.yml" "docs/ROOT/index.adoc"
".github/workflows/ci.yml" ".github/workflows/release.yml" )
for i in "${files[@]}"
do
echo "processing renaming in $i ...."
perl -077pi.bak -e 's/myproject/$ENV{'projectname'}/sg' $i
perl -077pi.bak -e 's/MyProject/$ENV{'projecttitle'}/sg' $i
if test -z "$shortprojectname"; then
perl -077pi.bak -e 's/set\\(PROJECT_SHORTNAME \"\"\\)/set(PROJECT_SHORTNAME "$ENV{'shortprojectname'}")/sg' $i
fi
perl -077pi.bak -e 's/myapp/$ENV{'appname'}/sg' $i
done
git mv src/.tests.myapp src/.tests.$appname
git status