coffee-scriptはnpmで入るからいいだろということでhomebrewからhomebrew-altに移動したらしいです。なのでnodeを入れてソースからnpmを入れる。

% brew install node
% curl http://npmjs.org/install.sh | sh
% npm install coffee-script -g

元のjsがある場合はjs2coffeeでcoffee化する。

% npm install js2coffee -g
% js2coffee foo.js > foo.coffee

guardやjitterで変更を検知してcoffeeをコンパイルする。titaniumで使われてるスクリプト言語はpythonなのでGuardfileがリポジトリにあると発狂する人がいる(?)のでjitterを使ってみました。(via @yagi_)

% npm install jitter -g
% jitter coffee Resources

coffeeディレクトリ以下のファイルに変更があると、同じ名前のjsがResources以下に出来る。

Xcodeを入れる。

Titanium Studioを入れる。(Titanium SDKがインストールされる)

最小限サンプル。komagata/titanium-foo

// Resources/app.js
var window = Ti.UI.createWindow({
  backgroundColor:'#ffffff',
  navBarHidden:true,
  exitOnClose:true
});
  
var label = Ti.UI.createLabel({
  color:'#000000',
  text:'foo',
  height:'auto',
  width:'auto'
});
window.add(label);
window.open()

プロジェクトディレクトリに入って下記。(.などの相対パスだと駄目なのでpwd (via @yagi_))

% ~/Library/Application\ Support/Titanium/mobilesdk/osx/2.0.2.GA/iphone/builder.py run "`pwd`"

skitchUl2P0b

できた。

何かおかしい場合は下記で大抵直るらしい。

% rm -rf build