since 2011-01-16
「Rubyを使って多くのスマートフォンプラットフォームのネイティブアプリケーションを開発できる」
http://www.infoq.com/jp/news/2010/04/rhodes-update
ruby で書く。ruby_on_rails に似た雰囲気。
マルチモーダルインタフェースのミドルウェア設計の参考になりそうなので要調査。
Rhodes[1]Rubyでネイティブモバイルアプリを作成 (IT Pro)
since 2011-07-25
http://docs.rhomobile.com/rhodes/install
下記、うまくいっているかどうかわからないがやってみる。
rvm で ruby 1.9 + rails 3.0 が動いている環境。
$ sudo gem install rhodes Password: Fetching: highline-1.6.2.gem (100%) Fetching: diff-lcs-1.1.2.gem (100%) Fetching: extlib-0.9.15.gem (100%) Fetching: templater-1.0.0.gem (100%) Fetching: macaddr-1.0.0.gem (100%) Fetching: uuid-2.3.2.gem (100%) Fetching: rhodes-3.0.2.gem (100%) Building native extensions. This could take a while... Successfully installed highline-1.6.2 Successfully installed diff-lcs-1.1.2 Successfully installed extlib-0.9.15 Successfully installed templater-1.0.0 Successfully installed macaddr-1.0.0 Successfully installed uuid-2.3.2 Successfully installed rhodes-3.0.2 7 gems installed Installing ri documentation for highline-1.6.2... Installing ri documentation for diff-lcs-1.1.2... unable to convert "\xA9" from ASCII-8BIT to UTF-8 for lib/diff/lcs/ldiff.rb, skipping Installing ri documentation for extlib-0.9.15... Installing ri documentation for templater-1.0.0... Installing ri documentation for macaddr-1.0.0... Installing ri documentation for uuid-2.3.2... Installing ri documentation for rhodes-3.0.2... unable to convert "\xA9" from ASCII-8BIT to UTF-8 for lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/README, skipping Enclosing class/module 'mDigest' for class MD5 not known Enclosing class/module 'mDigest' for class SHA1 not known Installing RDoc documentation for highline-1.6.2... Installing RDoc documentation for diff-lcs-1.1.2... unable to convert "\xA9" from ASCII-8BIT to UTF-8 for lib/diff/lcs/ldiff.rb, skipping Installing RDoc documentation for extlib-0.9.15... Installing RDoc documentation for templater-1.0.0... Installing RDoc documentation for macaddr-1.0.0... Installing RDoc documentation for uuid-2.3.2... Installing RDoc documentation for rhodes-3.0.2... unable to convert "\xA9" from ASCII-8BIT to UTF-8 for lib/extensions/barcode/ext/barcode/platform/iphone/ZBarSDK/README, skipping Enclosing class/module 'mDigest' for class MD5 not known Enclosing class/module 'mDigest' for class SHA1 not known
$ rhodes-setup We will ask you a few questions below about your dev environment. JDK path (required) (/Library/Java/Home): Android SDK path (blank to skip) (): /Applications/android-sdk-mac_x86 Android NDK path (blank to skip) (): /Applications/android-ndk-r6 Windows Mobile 6 SDK CabWiz (blank to skip) (): BlackBerry JDE 4.6 (blank to skip) (): BlackBerry JDE 4.6 MDS (blank to skip) (): BlackBerry JDE 4.2 (blank to skip) (): BlackBerry JDE 4.2 MDS (blank to skip) (): If you want to build with other BlackBerry SDK versions edit: /Users/nishimotz/.rvm/gems/ruby-1.9.2-p290/gems/rhodes-3.0.2/rhobuild.yml
$ pwd
/Users/nishimotz/work/rhodes
$ rhodes app myspace
Generating with app generator:
[ADDED] myspace/rhoconfig.txt
[ADDED] myspace/build.yml
[ADDED] myspace/app/application.rb
[ADDED] myspace/app/index.erb
[ADDED] myspace/app/index.bb.erb
[ADDED] myspace/app/layout.erb
[ADDED] myspace/app/loading.html
[ADDED] myspace/Rakefile
[ADDED] myspace/app/loading.png
[ADDED] myspace/app/helpers
[ADDED] myspace/icon
[ADDED] myspace/app/Settings
[ADDED] myspace/public
下記に書いてあるとおりに
http://docs.rhomobile.com/rhodes/generator
$ rhodes model account name,industry
$ rhodes spec
次の画面で気づいたが ruby 1.8.7 を使えと。。
http://docs.rhomobile.com/rhodes/build
まあこのままやってみよう。
$ rake switch_app
$ rake build:iphone:setup_xcode_project
なんと Xcode Project ファイルがこんなところに。。
/Users/nishimotz/.rvm/gems/ruby-1.9.2-p290/gems/rhodes-3.0.2/platform/iphone
これを Xcode 3.2 で開いて「ビルドと実行」した。いきなり iPad のシミュレーター画面だが、動いた。何をするアプリなのかわかってないが。。
Xcode を使わないで下記でも可能。
$ rake run:iphone
Android は。。。
rake aborted! Can't detect NDK toolchain path (corrupted NDK installation?)
https://groups.google.com/forum/#!topic/rhomobile/H2JiBSqfc1U/discussion
http://osdir.com/ml/rhomobile/2011-07/msg00337.html
http://osdir.com/ml/rhomobile/2011-07/msg00357.html
Current Rhodes 3.0.2 gem supports r5b NDK. ということで、頑張ってみたが ndk-r6 では動かないようだ。
https://www.pivotaltracker.com/projects/45686?story_id=15725849
ndk-r5b を入手したいのだがわからない。。
rhodes gem を git リポジトリの最新版にしてみろという話。。
と思ったら、下記から r5c が手に入った。。
http://androidapplications2011.blogspot.com/2011/07/download-android-ndk.html
NDK の path を変えて、下記も再実行:
$ rhodes-setup
myspace ディレクトリにて:
$ rake run:android
一生懸命コンパイルを始めた。。
しばらくして emulator のウィンドウが開いた。
その後もコンソールで何やら続いている。。
どうやら Android 3.1 のエミュレーターがものすごくゆっくり動いているらしい。。
いったん止める。
build.yml に下記を追加:
android: version: 2.1
もう一度 rake run:android したら今度は小さな画面のエミュレータが出た。
since 2011-08-27
新しいバージョンが出ているので再チャレンジしてみた:
$ sudo gem install rhodes Password: Fetching: rhodes-3.1.0.gem ( 58%)
$ rhodes-setup We will ask you a few questions below about your dev environment. JDK path (required) (/Library/Java/Home): Android SDK path (blank to skip) (/Applications/android-sdk-mac_x86): Android NDK path (blank to skip) (/Applications/android-ndk-r6): Windows Mobile 6 SDK CabWiz (blank to skip) (): BlackBerry JDE 4.6 (blank to skip) (): BlackBerry JDE 4.6 MDS (blank to skip) (): BlackBerry JDE 4.2 (blank to skip) (): BlackBerry JDE 4.2 MDS (blank to skip) (): If you want to build with other BlackBerry SDK versions edit: /Users/nishimotz/.rvm/gems/ruby-1.9.2-p290/gems/rhodes-3.1.0/rhobuild.yml
$ rhogen app myspace2 $ cd myspace2 $ rake switch_app $ rake run:iphone
build.yml:
android: version: 2.3.3
$ rake run:android