-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate.sh
37 lines (32 loc) · 1.12 KB
/
generate.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
#!/bin/sh
command_error_exit() {
$*
if [ $? -ne 0 ]
then
exit 1
fi
}
if [ $# -lt 2 ]
then
echo "use [$0 project_name namespace]"
exit 0
fi
project_name=$1
namespace=$2
command_error_exit mkdir $project_name
command_error_exit cd $project_name
command_error_exit git clone https://github.com/JUHPS/juhps-server.git
command_error_exit cp juhps-server/Makefile .
command_error_exit cp -rf juhps-server/template/* .
command_error_exit cp -rf juhps-server/template/* .
command_error_exit mv template ${namespace}
command_error_exit sed -i "s/project_name/${project_name}/g" CMakeLists.txt
command_error_exit sed -i "s/template/${namespace}/g" CMakeLists.txt
command_error_exit sed -i "s/project_name/${project_name}/g" move.sh
command_error_exit cd ${namespace}
command_error_exit sed -i "s/name_space/${namespace}/g" `ls .`
command_error_exit sed -i "s/project_name/${project_name}/g" `ls .`
command_error_exit cd ../bin/conf
command_error_exit sed -i "s/name_space/${namespace}/g" `ls .`
command_error_exit sed -i "s/project_name/${project_name}/g" `ls .`
echo "create module ${project_name} -- ${namespace} ok"