titanium cli + tishadow + alloy + coffeescriptでandroidアプリ作成手順まとめ
過去3回のエントリーで環境は出来上がったのでtitanium cli + tishadow + alloy + coffeescriptでandroidアプリ作るときの手順まとめ
titanium studio by winodws7 を卒業して titanium cli + tishadow by ubuntu12.04にしてみた① - shoprevのブログ
titanium studio by winodws7 を卒業して titanium cli + tishadow by ubuntu12.04にしてみた② - shoprevのブログ
titanium studio by winodws7 を卒業して titanium cli + tishadow by ubuntu12.04にしてみた③ - shoprevのブログ
1.ノートパソコン無線ルーター化
netsh wlan start hostednetwork
2.tishadowサーバー起動&android端末のtishadowアプリ起動
vagrant up vagrant ssh tmux tishadow server
3.アプリ作成
C-b % titanium create --p android --n hello --id com.hoge.hello cd hello alloy new alloy generate jmk
下記内容をalloy.jmkにコピペ
task("pre:compile", function(event,logger) { var wrench = require("wrench"), fs = require("fs"), path = require("path"), coffee = require("coffee-script"); event.alloyConfig.coffee = []; wrench.readdirSyncRecursive(event.dir.home).forEach(function(target){ if (target.match(/\.coffee$/)) { event.alloyConfig.coffee.push(target.replace(/\.coffee$/, ".js")); fs.writeFileSync( path.join(event.dir.home,target.replace(/\.coffee$/, ".js")), coffee.compile(fs.readFileSync(path.join(event.dir.home + "/" + target)).toString(), { bare: true })); } }); }); task("post:compile",function(event,logger){ var fs = require("fs"); event.alloyConfig.coffee.forEach(function(target){ fs.unlinkSync(event.dir.home + "/" + target); }); });
ソースが変更されたら自動でalloyコンパイル
supervisor -n exit -w app -e "coffee|tss|xml" -x alloy -- compile --config platform=android
4.tishadow自動実行
C-b % supervisor -n exit -w Resources -x tishadow run
あとはソースを編集保存するだけで3秒後には実機に反映される