titaniumとcoffeeと
最近お仕事でtitaniumでのiphoneアプリ開発などちょいちょいしております。
で、最初はフツーにjavascriptをガリガリ書いてたのですが、coffeescriptなるものの噂を聞いたので使ってみるとこりゃいいやということに。
で、こっから本題。
で、coffeescriptってjsにコンパイルしなきゃいけないんですが毎度叩くのもなんだかなーて感じだったのでwatchrていうgemがあったのでこいつをインストール。
- coffee_compile.watchr
coffee_files = %r{^(.*\.coffee)$} watch(coffee_files) do cmd = "coffee --bare --compile ." puts "$#{cmd}" `#{cmd}` end
で、下記で実行。
watchr -d coffee_compile.watchr
しかし、追加ファイル感知してくれないとか、ファイル削除のイベントがなぜか止まらないとかあったので、結局使わなくなったり。
というわけで、毎度コンパイル叩くことにしたんだけど、
ちょっとは楽しようということでRakefile書いた
- Rakefile
task :default => ["coffee:compile"] def show_and_cmd(title, cmd = nil) cmd = title if cmd.nil? puts %{===== #{title} =====} puts %{$#{cmd}} system cmd end namespace :coffee do desc "Compile coffee scripts" task :compile do show_and_cmd 'compile coffee', %{coffee --bare --compile .} end desc "Watch coffee scripts" task :watch do watchr_file = 'coffee_compile.watchr' show_and_cmd 'watching files', %{watchr -l #{watchr_file}} puts '' show_and_cmd 'watch coffee', %{watchr -d #{watchr_file}} end end
これで、
rake #または rake coffee:compile
でコンパイルできるぜー。ひゃっほい。
いちおう念のため、watchrのほうも
rake coffee:watch
でいけるようにしてたり。
あと、titaniumのほうも
titaniumって普段はbuildやシミュレータの起動をtitanium developerてアプリを立ち上げといて、その中にあるボタンをぽちっとなするわけなんですが、毎度これ起動しとくのヤダナーと思ってたんですよ。
と思ってたら、なんかコマンドラインで叩けるらしいじゃないですか。
コマンドラインでTitanium Mobileを操作する - kaz_konno’ blog: walkthisway
やったー!
というわけでRakefile修正。
task :default => ['coffee:compile', 'titanium:run'] def show_and_cmd(title, cmd = nil) cmd = title if cmd.nil? puts %{===== #{title} =====} puts %{$#{cmd}} system cmd end namespace :titanium do desc "build & run on iphone simulator" task :run do show_and_cmd 'build & run', '/Library/Application\ Support/Titanium/mobilesdk/osx/1.7.X/iphone/builder.py run ./' end end namespace :coffee do desc "Compile coffee scripts" task :compile do show_and_cmd 'compile coffee', %{coffee --bare --compile .} end desc "Watch coffee scripts" task :watch do watchr_file = 'coffee_compile.watchr' show_and_cmd 'watching files', %{watchr -l #{watchr_file}} puts '' show_and_cmd 'watch coffee', %{watchr -d #{watchr_file}} end end namespace :git do desc %{Show "git diff -- *.coffee"} task :diff do show_and_cmd 'git diff *.coffee', 'git diff -- \*.coffee' end end
「rake」で以下まとめて出来るようになったよー。
- coffeescriptのコンパイル
- titaniumのビルド
- iphone simulatorの起動
やったー!
#ちなみにRakefieの最後に書いてあるrake git:diffはcoffeeファイルの差分だけ見たくてよく使うコマンドだったのでついでに追加しといた。
Prev / Next in same category
Comment Form
Trackbacks (1)
llaneza
titaniumとcoffeeと | おれせか
Comments (10)
Refrain from earning funds by just Eu Joining, loan provider wire or simply revenue structure. If you work with an individual’s mastercard you could as a minimum remember you get your hard earned cash to come back for those who attain hardly any see.ありませ
Thanks your post,The post is written in very a good manner and it entails much useful information for me. I am happy to find your distinguished way of writing the post.
http://www.shtcshillong.org
在庫情報随時コピー更新!(*^-^*)
100%品質保証!コピー靴満足保障!
財布服のグッチコピー着たのが少なくて、靴も不十分です。
コピーの商品がグッチコピー低価格でお客様に
品質を最大限本物と同等とする為に相応の材質にて製作靴している為です。
しもやけを生んで、風邪を引いて風邪を引きます後の結果財布コピー。
ほんとはまとめて変換しないでちゃんと対象ファイルしっかり選んで変換したほうがきっといいよ!
このシャネル腕時計のブランドの自分、
シャネル激安http://www.cctoh.com/
93―01チップを基礎にする93―02は自動的に鎖の機械のチップに行って駆動します。
シャネル財布
シャネルピアス
シャネル眼鏡
シャネルバッグ
シャネル腕時計
シャネル靴
このチップは48時間の動力を持って貯蓄して、
シャネル激安腕時計の使用更におだやかで心地良くて、
飛行する陀はずみ車は8粒のねじの調節の後の改良システムでと腕時計、
シャネル完璧な精密で正確な度を確保しました。
良い書き込み記事をありがとう!それは実際にはアミューズメントアカウントです。
bundle exec rails g migration add_max_attempts_to_delayed_jobs max_attempts:integer
bundle exec rails g migration add_max_attempts_to_delayed_jobs max_attempts:integer
宝のスーパーコピーめでたい(ミュウミュウ)。
↑の記事を読んで、おおこりゃいいやと思いつつ使ってみた時に気づいたことメモ。