自動(dòng)分發(fā),一鍵安裝v2版,部署更簡(jiǎn)單,多版本同時(shí)顯示
建議先閱讀第一版本,了解一下流程。本文只講解主要配置流程。
這次版本需要安裝python,mac os自帶,所以用本機(jī)做分發(fā)的不需要擔(dān)心。
runserver.py
這次服務(wù)器部置只要一個(gè)py文件就可以完全搞定。
py文件中只需要修改這幾行
host = "http://192.168.1.188:8080/"#服務(wù)器ip
ipaname = "InstaSoccer"#與xcode打包時(shí)代碼的ipa名相同
bundleid = "com.minroad.appid"#bundle id
appname = "一鍵安裝" #app name
在xcode里run script里面加入如下代碼,scp是將ipa上傳到與py文件同一目錄下
# Date: 2013-06-20
# Author: Seamus
# Sina Weibo: @qdvictory
# compress application.
if [ "${CONFIGURATION}" = "ad_hoc" ]; then
#.app名,默認(rèn)與target name一致
ipaname="InstaSoccer"
#工程所在目錄為根目錄
pathtoartwork="isoccer/icon/iTunesArtwork"
#scp上傳用戶名及ip
sshhost="sshuser@192.168.1.188"
/bin/mkdir $CONFIGURATION_BUILD_DIR/Payload
/bin/cp -R $CONFIGURATION_BUILD_DIR/${ipaname}.app $CONFIGURATION_BUILD_DIR/Payload
/bin/cp ${pathtoartwork} $CONFIGURATION_BUILD_DIR/iTunesArtwork
cd $CONFIGURATION_BUILD_DIR
# zip up the Instasoccer directory
/usr/bin/zip -r ${ipaname}.ipa Payload iTunesArtwork
#rm -R $CONFIGURATION_BUILD_DIR/Payload 放到上傳ipa之后,否則會(huì)提示簽名錯(cuò)誤
/usr/bin/scp ${ipaname}.ipa ${sshhost}:~/ipa_publish/${ipaname}_`date +%Y%m%d%H%M`_$(/usr/libexec/PlistBuddy -c "Print :CFBundleVersion $REV" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}").ipa
rm -R $CONFIGURATION_BUILD_DIR/Payload
rm ${ipaname}.ipa
fi
exit 0
如果想要下載時(shí)有圖標(biāo)的話,在py文件同目錄下添加Icon.png文件就可以
接下來(lái),啟動(dòng)Server
nohup python runserver.py 8080 > /dev/null 2>&1 &
手機(jī)訪問(wèn)服務(wù)器ip,一切ok