gem shenzhenで ターミナルからアプリをビルドしtestflightを投げる
iphone アプリのビルドとテストフライトの配布をコマンドラインで行なってくれる shenzhen という gemがあります。 日本語情報が見当たらなかったので、記事にしてみました。ちょっとしたハマりポイントがいくつかありました。 ちなみに shenzhen という名称は iphoneのパーツを生成するfoxconn の工場がある中国の都市 深セン市に由来しています。
1. shenzhen を gem Installする
$ gem install shenzhen $ ipa -v ipa 0.3.0
2. ipa を build する
プロジェクトのディレクトリで コマンドを実行します. -c オプションでRelease を指定する必要があります。
$ ipa build -c Release Building "MyApp.xcworkspace" with Scheme "MyApp" and Configuration "Release" xcodebuild MyApp.xcworkspace 2013-05-22 02:41:27.614 xcodebuild[18441:80b] Error loading /Users/u16suzu/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin/Contents/MacOS/Alcatraz: dlopen(/Users/u16suzu/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin/Contents/MacOS/Alcatraz, 265): Symbol not found: _OBJC_CLASS_$_NSObject Referenced from: /Users/u16suzu/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin/Contents/MacOS/Alcatraz Expected in: /usr/lib/libobjc.A.dylib in /Users/u16suzu/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin/Contents/MacOS/Alcatraz 2013-05-22 02:41:27.616 xcodebuild[18441:80b] WARNING: Failed to load plugin at: /Users/u16suzu/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin, skipping. Could not load bundle. xcrun PackageApplication zip MyApp.app.dSYM MyApp.ipa successfully built
ワーニングらしきものがでますが、無事ビルドできているので問題ないと思います。
3. testflightを投げる準備
(1). testflightのapi token をメモします https://testflightapp.com/account/#api
(2). testflightのteam token をメモします https://testflightapp.com/dashboard/team/edit/
(3). 配布するメンバーのリストを作る testflight の 各アプリのPermissionsで Create New Listをクリックし メンバーとリスト名を決める。
4. testflight を投げる
コマンドは以下の通り。実行すると、Release notesのためのエディタが開きます。
$ ipa distribute:testflight -a APITOKEN -T TEAM_TOKEN --notify -l MEMBER_LIST_NAME
-l で配布するメンバーのリストを指定しない場合でも、アップロードは成功します。しかし、そうした場合ビルドごとにtestflightのサイトで、Access Grant を付与しなければ、ユーザはインストールできないので、指定して下さい。
個人的には以下の様なshellスクリプトファイルを作成して使っています。
build_and_testflight.sh
ipa build -c Release && ipa distribute:testflight -a API_KEY -T TEAM_TOKEN --notify -l TEAM_NAME
ipa distribute:testflight コマンドのオプション詳細は以下のとおりです。
Options: -f, --file FILE .ipa file for the build -d, --dsym FILE zipped .dsym package for the build -a, --api_token TOKEN API Token. Available at https://testflightapp.com/account/#api-token -T, --team_token TOKEN Team Token. Available at https://testflightapp.com/dashboard/team/edit/ -m, --notes NOTES Release notes for the build -l, --lists LISTS Comma separated distribution list names which will receive access to the build --notify Notify permitted teammates to install the build --replace Replace binary for an existing build if one is found with the same name/bundle version
参考:
gem shenzhen
https://github.com/mattt/shenzhen
巨大な Helios を取り巻く gem 群について調べてみた