views:

65

answers:

1

Hi,

I started using bundler and have some problems getting it working. I have the following gemfile:

source "http://rubygems.org" gem "rack", "~>1.1" gem 'pg','>= 0.8.0' gem 'rails','2.3.8' gem 'authlogic','2.1.3' gem 'ajaxful_rating','2.2.3' gem 'will_paginate','2.3.12' gem 'right_aws','1.10.0' gem 'aws-s3','0.6.2' gem 'declarative_authorization','0.4.1' gem 'timeline_fu','0.3.0' gem 'friendly_id','>= 3.1'

Notice that I specificy that I want to use rack 1.1 (1.1.0).

I get the following error when I run with thin (Webrick works fine):

thin start

Using rails adapter /usr/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/runtime.rb:27:in setup': You have already activated rack 1.2.1, but your Gemfile requires rack 1.1.0. Consider using bundle exec. (Gem::LoadError) from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/spec_set.rb:12:ineach' from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/spec_set.rb:12:in each' from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/runtime.rb:17:insetup' from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler.rb:100:in setup' from /home/vmplanet/Documents/maga/config/../config/preinitializer.rb:16 from /home/vmplanet/Documents/maga/config/boot.rb:28:inload' from /home/vmplanet/Documents/maga/config/boot.rb:28:in preinitialize' from /home/vmplanet/Documents/maga/config/boot.rb:10:inboot!' from /home/vmplanet/Documents/maga/config/boot.rb:126 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire' from /home/vmplanet/Documents/maga/config/environment.rb:7 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire' from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/rack/adapter/rails.rb:42:in load_application' from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/rack/adapter/rails.rb:23:ininitialize' from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/rack/adapter/loader.rb:48:in new' from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/rack/adapter/loader.rb:48:infor' from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/thin/controllers/controller.rb:163:in load_adapter' from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/thin/controllers/controller.rb:67:instart' from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/thin/runner.rb:177:in send' from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/thin/runner.rb:177:inrun_command' from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/thin/runner.rb:143:in `run!'

So basically it is complaining that I am using rack 1.2.1 (which is not the case, I can't think of anything using it).

Any thoughts?

Thanks for any help.

Regards, Nick

A: 

Thin itself depends on Rack. And because Thin will load itself before it loads your application, the most recent version of Rack will already be loaded when bundler first enters the picture.

You have to force the correct version of Rack to Thin. In theory you could only have Rack 1.1.0 in your system gems, but that's hardly maintainable or portable. The error message already contains the answer; use bundle exec.

bundle exec thin start
molf
Hi,thanks this works, btw: bundle exec thin start.
So how do I get that working on Heroku?
I can't help you with Heroku, perhaps their bundler documentation will help: http://docs.heroku.com/bundler
molf
I don't understand why rack 1.2.1 is being used as default. Isn't the whole point of bundler to tell what versions of gems should be used? I understand that there should be some initial load of rack, but why not have an auto reload to rack 1.1.0 if that's what is defined.
There's no way to unload a gem; so if Bundler isn't loaded first, there's no way it can fix the version mismatch. The solution is `bundle exec`, and this is exactly the reason for its existence.
molf
Thanks Molf, I understand, basically the issue for me now is to find out how to get this working on Heroku. I can't find how to issue the command on Heroku.