Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Installation fails on RubyMotion install with Ruby 1.8 #168

Closed
dlo opened this Issue Nov 9, 2012 · 12 comments

Comments

Projects
None yet
4 participants

dlo commented Nov 9, 2012

I've just purchased RubyMotion and just ran gem install bubble-wrap. My Rakefile looks like this:

# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'
require 'bubble-wrap'

Motion::Project::App.setup do |app|
  # Use `rake config' to see complete project settings.
  app.name = 'Issues'
  app.identifier = 'io.aurora.Issues'
end

This is what happens when I run rake:

$ rake --trace
(in MYFOLDER)
rake aborted!
no such file to load -- bubble-wrap
MYFOLDER/Rakefile:4:in `require'
MYFOLDER/Rakefile:4
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2383:in `load'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2383:in `raw_load_rakefile'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2017:in `load_rakefile'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2016:in `load_rakefile'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2000:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:1998:in `run'
/usr/bin/rake:31

It appears as though the installation failed. Would love any pointers in the right direction, thanks!

Member

clayallsopp commented Nov 9, 2012

Looks like you're using the system-default Ruby 1.8 to run RubyMotion, that on purpose? I don't know if RubyMotion supports 1.8.x. Either way, running rake is probably using that Ruby's gem path.

What does which gem say?

Member

supermarin commented Nov 9, 2012

Just to confirm - are you sure you've did gem install bubble-wrap ?

dlo commented Nov 9, 2012

@clayallsopp nope, not on purpose. I simply installed RubyMotion with the installer application. I didn't futz with the version I would be using.

@mneorr yep, just ran gem install bubble-wrap

dlo commented Nov 9, 2012

Maybe this can be solved by running under RVM? None of the other commands fail when I do that though...

I.e., when I remove require 'bubble-wrap' from the Rakefile, rake runs perfectly and starts the app in a simulator.

Member

clayallsopp commented Nov 9, 2012

It seems like RubyMotion is using a version of Ruby/RubyGems that is different from what your normal gem command uses.

Check which ruby and which gem and see if they match up. Or try requiring any other non-standard gem which you know is installed and see if it also fails in the Rakefile.

But regardless, running everything under RVM/rbenv should solve that...

dlo commented Nov 10, 2012

$ which ruby
/usr/bin/ruby
$ which gem
/usr/bin/gem

Further data:

$ ls -al /usr/bin/gem 
lrwxr-xr-x  1 root  wheel  71 Aug  6 14:12 /usr/bin/gem -> ../../System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/gem
$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
$ ls -al /usr/bin/ruby
lrwxr-xr-x  1 root  wheel  76 Aug  6 14:13 /usr/bin/ruby -> ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby

I'm not a ruby guy, so apologies if I'm missing something that should be obvious by now.

dlo commented Nov 10, 2012

I don't really understand what I'm doing wrong. Is there some part of the installation that I failed to read? Pretty much my exact steps to get here were:

  1. Download RubyMotion.
  2. Install RubyMotion.
  3. Start first project.
  4. gem install bubble-wrap
  5. Requiring BubbleWrap fails.

I haven't used Ruby on this computer at any point in the past. This is a factory install.

Member

clayallsopp commented Nov 10, 2012

Mmm I don't think the RubyMotion installer tries to account for RubyGems, as it's not strictly required to run RubyMotion =\ You should submit a new support ticket with the motion support command and request it, though.

What I guess is happening is Ruby is looking for your gems in /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems, but the gems command isn't installing them there.

  • Try ls -al /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems and seeing if a bubble-wrap directory exists.
  • Confirm that the output of gem list contains "bubble-wrap"
  • Try running a vanilla instance of irb and executing require "bubble-wrap". If it fails, then it's a problem beyond just RubyMotion.

Can you paste the output of gem environment too? For comparison, mine:

$ gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.23
  - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-darwin12.0.0]
  - INSTALLATION DIRECTORY: /Users/me/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: /Users/me/.rbenv/versions/1.9.3-p194/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/me/.rbenv/versions/1.9.3-p194/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-12
  - GEM PATHS:
     - /Users/clayallsopp/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1
     - /Users/clayallsopp/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

Alternatively, installing RVM/rbenv + a fresh RubyGems should fix the problem.

dlo commented Nov 10, 2012

Yeah, it does seem this is probably a problem with the RubyMotion installation itself.

Here's my gem environment:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.24
  - RUBY VERSION: 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
  - INSTALLATION DIRECTORY: /usr/local
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-12
  - GEM PATHS:
     - /usr/local
     - /Users/dan/.gem/ruby/1.8
     - /Library/Ruby/Gems/1.8
     - /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => false
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "install" => "--no-rdoc --no-ri --no-doc"
     - "update" => "--no-rdoc --no-ri --no-doc"
     - "gem" => "--no-rdoc --no-ri --no-doc -n/usr/local/bin"
  - REMOTE SOURCES:
     - http://rubygems.org/

You might find this useful as well:

$ ls /usr/local/gems | grep bubble-wrap
bubble-wrap-1.1.4

Per other questions:

Try ls -al /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems and seeing if a bubble-wrap directory exists.

It does not. This is very strange. I also ran the following:

$ head -n1 /usr/bin/gem
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

Confirm that the output of gem list contains "bubble-wrap"

$ gem list --local | grep bubble-wrap
bubble-wrap (1.1.4)

Try running a vanilla instance of irb and executing require "bubble-wrap". If it fails, then it's a problem beyond just RubyMotion.

It fails, but I think it fails in the "good" way. :)

$ irb
irb(main):001:0> require 'bubble-wrap'
RuntimeError: This file must be required within a RubyMotion project Rakefile.
  from /usr/local/gems/bubble-wrap-1.1.4/lib/bubble-wrap/loader.rb:2
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
  from /usr/local/gems/bubble-wrap-1.1.4/lib/bubble-wrap/core.rb:1
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
  from /usr/local/gems/bubble-wrap-1.1.4/lib/bubble-wrap.rb:2
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:60:in `gem_original_require'
  from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:60:in `require'
  from (irb):1

dlo commented Nov 10, 2012

Just submitted a report to the RubyMotion team.

Contributor

Watson1978 commented Nov 11, 2012

Looks like you are using Ruby18.
When will use gem on Ruby18, we will require rubygems because it does not load automatically.

require 'motion/project'

require 'rubygems' # add
require 'bubble-wrap'

@dlo dlo closed this Nov 11, 2012

dlo commented Nov 11, 2012

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment