project_name=$1
target_dir="/home/quant_group/${project_name}"
qaapi='http://172.30.220.22:3003'
git_path=`curl -s "${qaapi}/proconfig/get_info?system_name=${project_name}&key=git_path"`

if [ ! -d "$project_name" ];then
	echo "not exist"
	git clone ${git_path}
	cd ./${project_name}
else
	echo "exist"
	cd ./${project_name}
	git pull
fi

echo "部署项目开始"

if [ "$project_name" = "qa-platfrom-ui" ];then
	echo "这是一个UI项目"
	cd ${target_dir}
	npm install
	npm run build
	echo "done"
else
	echo "这是JAVA项目"
	cd ${target_dir}
	mvn clean package -Ptest -Dmaven.test.skip=true
	supervisorctl restart $project_name
	echo "done"
fi


