Search code examples
rubymotion

RubyMotion with BubbleWrap


I'm just starting to play around with Ruby Motion (v 1.9) and I'm having some trouble including BubbleWrap (v 0.2.1) into my project.

My Rakefile looks like:

$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'
require 'rubygems'
require 'bubble-wrap'

Motion::Project::App.setup do |app|
  # Use `rake config' to see complete project settings.
  app.name = "Hello"
  app.device_family = :ipad #[:ipad,:iphone]

  app.files += Dir.glob(File.join(app.project_dir, 'vendor/BubbleWrap/lib/**/*.rb'))
end

I've also tried by just using

require 'bubble-wrap'

but I consistently get an error that looks like this:

ERROR! Can't resolve dependency `/Library/Ruby/Gems/1.8/gems/bubble-wrap
0.2.1/lib/pollute.rb' because ./Library/Ruby/Gems/1.8/gems/bubble-wrap-0.2.1/lib/pollute.rb 
is not in ["./app/app_delegate.rb", 
"./app/login_controller.rb", "/Library/Ruby/Gems/1.8/gems/bubble-wrap-0.2.1/lib/bubble-wrap/app.rb", 
"/Library/Ruby/Gems/1.8/gems/bubble-wrap-0.2.1/lib/bubble-wrap/gestures.rb", 
"/Library/Ruby/Gems/1.8/gems/bubble-wrap-0.2.1/lib/bubble-wrap/http.rb", 
"/Library/Ruby/Gems/1.8/gems/bubble-wrap-0.2.1/lib/bubble-wrap/json.rb", 
"/Library/Ruby/Gems/1.8/gems/bubble-wrap-0.2.1/lib/bubble-wrap/kernel.rb", 
"/Library/Ruby/Gems/1.8/gems/bubble-wrap-0.2.1/lib/bubble-wrap/ns_index_path.rb", 
"/Library/Ruby/Gems/1.8/gems/bubble-wrap-0.2.1/lib/bubble-wrap/ns_notification_center.rb", 
"/Library/Ruby/Gems/1.8/gems/bubble-wrap-0.2.1/lib/bubble-wrap/ns_user_defaults.rb", 
"/Library/Ruby/Gems/1.8/gems/bubble-wrap-0.2.1/lib/bubble-wrap/ui_button.rb", 
"/Library/Ruby/Gems/1.8/gems/bubble-wrap-0.2.1/lib/bubble-wrap/ui_view_controller.rb", 
"/Library/Ruby/Gems/1.8/gems/bubble-wrap-0.2.1/lib/bubble-wrap/version.rb", 
"/Library/Ruby/Gems/1.8/gems/bubble-wrap-0.2.1/lib/pollute.rb"]

Do the newer versions of RubyMotion not work with BubbleWrap?


Solution

  • UPDATE: This was fixed as of bubble-wrap 0.3.1

    This is a bug in the bubble-wrap gem, it's trying to prepend the gem's path with a ./. I opened a pull request.

    For now, you can either use something like RVM or rbenv to install a separate copy of Ruby and use that, or you can manually patch /Library/Ruby/Gems/1.8/gems/bubble-wrap-0.2.1/lib/bubble-wrap.rb by changing line 14 to this:

    path = /^\.|\/Users\/|\/Library\/Ruby\/Gems\//.match(x) ? x : File.join('.', x)