-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sh
More file actions
52 lines (44 loc) · 1.46 KB
/
init.sh
File metadata and controls
52 lines (44 loc) · 1.46 KB
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
#!/bin/bash
export projectName=${1}
export gitRepository=${2}
if [ ! ${projectName} ];then
echo "please input your project name"
else
echo ${projectName} "init begin"
echo "rename project folder to ${projectName}"
cd ..
mv templateproject ${projectName}
cd ${projectName}
## change configuration *.xml (pom.xml, spring-*.xml)
echo "init xml files"
find . -name '*.xml' | xargs perl -pi -e 's|templateproject|'${projectName}'|g'
## change configuration *.properties
echo "init properties files"
find . -name '*.properties' | xargs perl -pi -e 's|templateproject|'${projectName}'|g'
## chang idea project info
echo "init idea project info"
find ./.idea/ -name ".name" | xargs perl -pi -e 's|templateproject|'${projectName}'|g'
for files in `find . -name "*.iml"`
do
# echo ${files}
## change modules name
mv ${files} ${files//templateproject/${projectName}}
done
## remove template git info
echo "remove templateproject git info"
rm -rf .git
## change package name
echo "change package name"
for files in `find . -type d | grep 'templateproject$'`
do
echo "move " ${files} " to " ${files//templateproject/${projectName}}
mv ${files} ${files//templateproject/${projectName}}
done
## init git info
if [ ${gitRepository} ]; then
echo "init git info"
git init
git remote add origin ${gitRepository}
fi
echo ${projectName} "init completed"
fi