Skip to content

Commit

Permalink
send email after upload
Browse files Browse the repository at this point in the history
  • Loading branch information
chenchengfang committed Feb 19, 2013
1 parent f9921c3 commit 1a66c80
Show file tree
Hide file tree
Showing 3 changed files with 2,231 additions and 14 deletions.
55 changes: 45 additions & 10 deletions ipa-publish
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,59 @@
# 修改人:ccf
# 修改内容:添加通过sftp上传到服务器的功能
#--------------------------------------------
# 修改日期:2013/02/19
# 修改人:ccf
# 修改内容:添加上传服务器后邮件提醒功能
#--------------------------------------------




#须配置内容 start

#存放该shell文件夹的路径
shell_path=~/shell

#发布应用的url地址
pulish_url="http://192.168.81.236/test"
pulish_url="http://**.com/"

#以下是邮箱的相关设置
#收件人
email_reciver=**@**
#发送者邮箱
email_sender=**@**
#邮箱用户名
email_username=**
#邮箱密码
email_password=**
#smtp服务器地址
email_smtphost=**


#可配置内容 end

#参数判断
if [ $# != 2 ] && [ $# != 1 ];then
echo "Number of params error! Need one or two params!"
echo "1.root path of project(necessary) 2.name used to display when installing"
echo "1.root path of project(necessary) 2.should send email after upload?y/n(default is n)"
exit
elif [ ! -d $1 ];then
echo "The param must be a dictionary."
exit

fi

should_email=n

if [ $# = 2 ];then
should_email=$2
if [ $should_email != y ] && [ $should_email != n ];then
echo "Error! The Second Param must be y or n!"
exit
fi
fi



#工程绝对路径
cd $1
Expand All @@ -57,11 +89,6 @@ if [ $rtnValue != 0 ];then
fi


#IPA名称
if [ $# = 2 ];then
ipa_name=$2
fi

#build文件夹路径
build_path=${project_path}/build

Expand Down Expand Up @@ -99,9 +126,9 @@ rm -rf ${tmpfoldername}
#进入到工程build路径下
cd $build_path

if [ $# = 1 ];then
#显示名称
ipa_name="${display_name}"
fi


if [ -d ./$target_name ];then
rm -rf $target_name
Expand Down Expand Up @@ -188,4 +215,12 @@ cat << EOF > ${target_name}.plist
EOF

#调用upload脚本来将文件上传到服务器
~/shell/upload $target_name
${shell_path}/upload $target_name || exit

#发送邮件
if [ $should_email = y ];then
email_title="${ipa_name}-IOS客户端更新"
email_content="Use the safari browser on IOS device to download the app.URL: ${pulish_url}/${target_name} "
${shell_path}/sendEmail -f ${email_sender} -t ${email_reciver} -s ${email_smtphost} -u ${email_title} -xu ${email_username} -xp ${email_password} -m ${email_content}
fi

Loading

0 comments on commit 1a66c80

Please sign in to comment.