WEB+DB PRESS vol.74のrubymotion特集の写経中に
いくつかはまったのでメモしておきます。
2013/5/7微修正。rubymotionのversionが1.3.5になっていたのを1.35に修正。
1.bundlerでpathを指定した場合にwarningが表示される(未解決)
bundlerのinstall時にpathオプションでvendor/bundle以下にinstallするように記載されているので
同じように実施してみましたが、build時にwarningが出力されます。
$ bundle --path vendor/bundle
$ bundle exec rake Could not find rake-10.0.4 in any of the sources Run `bundle install` to install missing gems. (略)
というメッセージを出しながら、以降のBuildは実行されている。
ruby-motion側の問題のような気もするが、全然分からないので
pathオプションなしでbundle installしています。
pathオプションを使うそもそもの思想は、systemのgemsディレクトリを汚したくないのでproject root以下に
置いて行こうってことなんだろうけど
別にsystemに置いてもいいんじゃないの?とrails書いているときも思ってました。
依存関係はbundler先生が解決してくれるし全然問題ない気がする。
capistrano使うと勝手にpathオプション使うというのはあったりするんだけど、
いまいちpathオプションが有効なケースが分からない。
2.motion-cocoapods undefined method `project_root='
補足ですがcocoapodsをinstallしたらpod setupするのを忘れずに。
$ bundle exec rake rake aborted! undefined method `project_root=' for #<Pod::Config:0x007fc24388f100> /Users/trsw/work/motion/webdb74/RSSMotion/Rakefile:14:in `block in <top (required)>' /Library/RubyMotion/lib/motion/project/config.rb:111:in `call' /Library/RubyMotion/lib/motion/project/config.rb:111:in `block in setup' /Library/RubyMotion/lib/motion/project/config.rb:111:in `each' /Library/RubyMotion/lib/motion/project/config.rb:111:in `setup' /Library/RubyMotion/lib/motion/project/app.rb:60:in `config' /Library/RubyMotion/lib/motion/project/app.rb:72:in `build' /Library/RubyMotion/lib/motion/project.rb:51:in `block (2 levels) in <top (required)>' Tasks: TOP => default => simulator => build:simulator (See full trace by running task with --trace)
ぐぐると
Rake fails with undefined method `project_root=' for #<Pod::Config::0x007ffdd53bd488> · Issue #47 · HipByte/motion-cocoapods
この問題に関しては、1.3.0.rc1で解決しているそうですが
Cocoapods 0.17.x does not support gist-based podspec file · Issue #52 · HipByte/motion-cocoapods
他の問題もあるようです。
ひとまずupdateしてみると、とりあえず回避できたようです。
#Gemfile gem 'motion-cocoapods', '1.3.0.rc1'
bundle update
3.stack level too deep
$ bundle exec rake Build ./build/iPhoneSimulator-6.1-Development Build vendor/Pods rake aborted! stack level too deep Tasks: TOP => default => simulator => build:simulator (See full trace by running task with --trace)
1.28でビルドしたらstack level too deepに => 1.29で治りました - リンゴの水やり?(はてな)
RubyMotionのバージョンは1.35なので全然違うのですが
試しに入れてみると解決されました。
app.detect_dependencies = false
公式のSmart File Dependencies を見てみると
実験的な機能だからバグあるかも的なノリなので、今後に期待なんでしょうか。
RubyMotion API Reference, Smart File Dependencies - RubyMotion Blog
4. Gemfile
bundlerのsourceに指定するショートカットは古いのでhttps://rubygems.orgを指定しましょう - rochefort's blog
my environment
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.0] RubyMotion 1.35 Bundler 1.3.5 rubygems 2.0.3 cocoapods 0.19.1 motion-cocoapods 1.3.0.rc1
いろいろありますね。