开发者

Rails 3 bundler updating

I have an application running on thin 1.2.11 behind nginx. I was trying to update my application to the latest version of it's gems using bundle update on a development machine, commiting to git, then running cap deploy. However, thin is giving me the following error:

/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/runtime.rb:31:in `block in setup': You have already activated rack 1.3.0, but your Gemfile requires rack 1.2.3. Co开发者_如何学运维nsider using bundle exec. (Gem::LoadError)

On the server I have the following gems installed system wide:

bundler (1.0.14)
daemons (1.1.3)
eventmachine (0.12.10)
rack (1.3.0)
rake (0.9.2)
thin (1.2.11)

My Gemfile for my aplication:

source 'http://rubygems.org'

gem 'rails', '3.0.7'
gem 'sqlite3'
gem 'capistrano'
gem 'thin'
gem 'RedCloth'
gem 'will_paginate', '3.0.pre2'
gem 'jquery-rails'

I believe thin is requiring rack 1.3, while something in my Gemfile is requiring rack 1.2.3. Am I managing my gems the wrong way? What is the proper way to manage deployment and proper gem control?

I found using bundle exec thin start works, but I prefer a solution to allow me to use /etc/init.d/thin start.


Please read this: http://yehudakatz.com/2011/05/30/gem-versioning-and-bundler-doing-it-right/ before you tell us what you prefer.

Problem is you prefer to run command from gem installed into system to run application which has it's own dependencies (i.e. rack) specified in Gemfile. You can't have two version of same library loaded at the same time, so it's causing your problem with needing 'bundle exec' in from on every command.


Just do bundle exec at start of your cap scripts and he will pickup gems from bundler.

Often I have same problem if i have in system / currently used gemset newer versions of some gems.

i even have alias called be in shell for bundle exec. New versions of rvm do bundle exec automagicly also :).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜