A few replies:
- Where does Rails call the bundler code ?
…/config/boot.rb
More info in section 1.4 config/boot.rb of http://guides.rubyonrails.org/initialization.html
I just tried to replay that code.
When the rubyracer gem is present:
peterv@ASUS:~/b/rails-apps/apps/temp/base_app/config$ irb
001:0> require ‘bundler’
=> true
002:0> gemfile = File.expand_path(‘…/…/Gemfile’, FILE)
=> “/home/peterv/data/backed_up/rails-apps/apps/temp/base_app/Gemfile”
003:0> ENV[‘BUNDLE_GEMFILE’] = gemfile
=> “/home/peterv/data/backed_up/rails-apps/apps/temp/base_app/Gemfile”
004:0> Bundler.setup
=> "GEM\n remote: http://rubygems.org/\n specs:\n …
…
libv8 (3.3.10.2)\n
…
therubyracer (0.9.4)\n libv8 (~> 3.3.10)\n
When the rubyracer is removed (with gem uninstall libv8), I get:
peterv@ASUS:~/b/rails-apps/apps/temp/base_app/config$ gem uninstall libv8
You have requested to uninstall the gem:
libv8-3.3.10.2-x86-linux
therubyracer-0.9.4 depends on [libv8 (~> 3.3.10)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn] y
Successfully uninstalled libv8-3.3.10.2-x86-linux
peterv@ASUS:~/b/rails-apps/apps/temp/base_app/config$ irb
001:0> require ‘bundler’
=> true
…
003:0> gemfile = File.expand_path(‘…/…/Gemfile’, FILE)
=> “/home/peterv/data/backed_up/rails-apps/apps/temp/base_app/Gemfile”
004:0> ENV[‘BUNDLE_GEMFILE’] = gemfile
=> “/home/peterv/data/backed_up/rails-apps/apps/temp/base_app/Gemfile”
005:0> Bundler.setup
Bundler::GemNotFound: Could not find libv8-3.3.10.2 in any of the sources
from /home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler/spec_set.rb:90:in `block in materialize'
from /home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler/spec_set.rb:83:in `map!'
from /home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler/spec_set.rb:83:in `materialize'
from /home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler/definition.rb:90:in `specs'
from /home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler/definition.rb:135:in `specs_for'
from /home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler/definition.rb:124:in `requested_specs'
from /home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler/environment.rb:23:in `requested_specs'
from /home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler/runtime.rb:11:in `setup'
from /home/peterv/.rvm/gems/ruby-1.9.3-p0@base_app/gems/bundler-1.1.pv/lib/bundler.rb:109:in `setup'
from (irb):5
from /home/peterv/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `<main>'
006:0> quit
peterv@ASUS:~/b/rails-apps/apps/temp/base_app/config$ bundle install
Fetching gem metadata from http://rubygems.org/……
Using rake (0.9.2)
…
Installing libv8 (3.3.10.2)
…
Your bundle is complete! Use bundle show [gemname]
to see where a bundled gem is installed.
peterv@ASUS:~/b/rails-apps/apps/temp/base_app/config$ irb
001:0> gemfile = File.expand_path(‘…/…/Gemfile’, FILE)
=> “/home/peterv/data/backed_up/rails-apps/apps/temp/base_app/Gemfile”
002:0> ENV[‘BUNDLE_GEMFILE’] = gemfile
=> “/home/peterv/data/backed_up/rails-apps/apps/temp/base_app/Gemfile”
003:0> require ‘bundler’
=> true
004:0> Bundler.setup
success
- One hint may to run
$ bundle exec gem list
and carefully inspect the outcome (can be different from $ gem list)
Also study your Gemfile.lock file in detail for dependencies. Are all
dependencies met ? Does bundle update
help you? What is the
exact version of the libv8 you have installed?
- (slightly off-topic) How to avoid these issues altogether ?
This may be off-topic for your specific question, but in general, I find it easier
to set-up a dev server on Ubuntu 10.x, 11.x with rvm. I published my recent
experiences here:
http://rails.vandenabeele.com/blog/2011/11/26/installing-ruby-and-rails-with-rvm-on-ubuntu-11-dot-10/
Regarding the set-up of “therubyracer”, this is how it worked in
the rvm environment:
~/data/git/NewProject$ echo “gem ‘therubyracer’” >> Gemfile
~/data/git/NewProject$ bundle install
Fetching source index for http://rubygems.org/
…
Installing libv8 (3.3.10.4)
…
Installing therubyracer (0.9.9) with native extensions
…
Your bundle is complete! Use bundle show [gemname]
to see where a bundled gem is installed.
and that worked out of the box.
I Hope This Helps,
Peter