hogehoge foobar Blog Style Beta

Web,Mac,Linux,JavaScript,Perl,PHP,RegExp,Git,Vim,Redmineなど技術的なことのメモや、ちょっと便利そうなものの紹介をしています。

rascutを使って自動でActionScriptをコンパイル

ActionScriptのコンパイル環境を作ったのに情報をまとめていなかったので、エントリ。
今回は自動でコンパイルとブラウザリロードをしてくれるrascut

にとよんさんのページを参考にさせていただきました。

ActionScript やるなら入れとけ。rascut 導入と使い方。
http://d.hatena.ne.jp/nitoyon/20070914/how_to_install_rascut
1.rubyのインストール
rascutはRubyGemのため、Rubyが必要となるので、事前にインストール。
インストール用コマンド

$ sudo apt-get install ruby

2.rascutのインストール
・RubyGemでrascutをインストール。
インストール用コマンド
$ gem install rascut --include-dependencies

rascutにパスを通す。
PATH="$PATH:/usr/local/bin/flex_sdk/bin:/home/goofy/.gem/ruby/1.8/gems/rascut-0.2.1/bin"

3.rascutでコンパイル
rascutでソースファイルをコンパイル。
$ rascut GreetingApp.as 
[11/21 02:28:04] Compile Start
[11/21 02:28:05] Found update file(s)["./GreetingApp.as"]
[11/21 02:28:08] fcsh: Assigned 1 as the compile target id
Loading configuration file /usr/local/bin/flex_sdk/frameworks/flex-config.xml
/home/goofy/flex/20/GreetingApp.swf (772 bytes)

これで、ソースファイルを更新すると自動でコンパイルが実行される。

・ブラウザを自動リロードする場合サーバーモードで起動する。
・サーバーモードは-sオプションを使用する。

$ rascut -s GreetingApp.as 
[11/21 02:30:04] Start Mongrel: http://0.0.0.0:3001/
[11/21 02:30:04] Compile Start
[11/21 02:30:05] Found update file(s)["./GreetingApp.as"]
[11/21 02:30:08] fcsh: Assigned 1 as the compile target id
Loading configuration file /usr/local/bin/flex_sdk/frameworks/flex-config.xml
/home/goofy/flex/20/GreetingApp.swf (772 bytes)

http://0.0.0.0:3001/にアクセスすればブラウザが自動リロードされる。