生产轨道部署中的两个版本的gem

我认为我的生产中的gemfile存在一些问题,因为它与我的开发不同,我认为这导致我的部署(Capistrano)失败,至少在捆绑安装时间

发展

actionmailer (3.2.3) actionpack (3.2.3) activemodel (3.2.3) activerecord (3.2.3) activeresource (3.2.3) activesupport (3.2.3) arel (3.0.2) bcrypt-ruby (3.0.1) builder (3.0.4) bundler (1.3.4) capistrano (2.14.2, 2.12.0) climate_control (0.0.3) cocaine (0.5.1, 0.2.1) coffee-rails (3.2.2) coffee-script (2.2.0) coffee-script-source (1.6.2, 1.3.3) commonjs (0.2.6) daemon_controller (1.1.2, 1.0.0) daemons (1.1.9) database_cleaner (0.9.1, 0.8.0) devise (2.2.3) diff-lcs (1.2.2, 1.1.3) erubis (2.7.0) eventmachine (1.0.0) execjs (1.4.0) fastthread (1.0.7) ffi (1.6.0, 1.3.1) font-awesome-rails (3.0.2.0) highline (1.6.16, 1.6.13) hike (1.2.1) i18n (0.6.4, 0.6.1) journey (1.0.4) jquery-rails (2.2.1, 2.0.2) json (1.7.7, 1.7.6) less (2.3.1, 2.2.1) less-rails (2.3.2, 2.2.3) libv8 (3.11.8.17 x86_64-linux, 3.3.10.4 x86_64-linux) listen (0.7.3, 0.7.2) mail (2.4.4) mime-types (1.22, 1.19) multi_json (1.7.2, 1.5.0) mysql2 (0.3.11) nested_form (0.3.1, 0.3.0) net-scp (1.1.0, 1.0.4) net-sftp (2.1.1, 2.0.5) net-ssh (2.6.6, 2.5.2) net-ssh-gateway (1.2.0, 1.1.0) orm_adapter (0.4.0) paperclip (3.4.1, 3.1.4) passenger (3.0.19, 3.0.14) polyglot (0.3.3) rack (1.4.5, 1.4.4) rack-cache (1.2) rack-ssl (1.3.3) rack-test (0.6.2) rails (3.2.3) railties (3.2.3) rake (10.0.4, 10.0.3) rb-inotify (0.9.0, 0.8.8) rb-readline (0.4.2) rdoc (3.12.2, 3.12) ref (1.0.4) rmagick (2.13.2, 2.13.1) rspec (2.11.0) rspec-core (2.13.1, 2.11.1) rspec-expectations (2.13.0, 2.11.1) rspec-mocks (2.13.0, 2.11.1) rspec-rails (2.13.0, 2.11.0) rubygems-bundler (1.1.1) rvm (1.11.3.6) sass (3.2.7, 3.1.20) sass-rails (3.2.6, 3.2.5) sprockets (2.1.3) therubyracer (0.11.4, 0.10.1) thor (0.14.6) tilt (1.3.6, 1.3.3) treetop (1.4.12, 1.4.10) twitter-bootstrap-rails (2.2.6, 2.1.1) tzinfo (0.3.37, 0.3.33) uglifier (1.3.0, 1.2.6) warden (1.2.1) will_paginate (3.0.4) 

生产

 actionmailer (3.2.3) actionpack (3.2.3) activemodel (3.2.3) activerecord (3.2.3) activeresource (3.2.3) activesupport (3.2.3) arel (3.0.2) bcrypt-ruby (3.0.1) builder (3.0.4) bundler (1.1.4, 1.1.3) capistrano (2.12.0) cocaine (0.2.1) coffee-rails (3.2.2) coffee-script (2.2.0) coffee-script-source (1.3.3) commonjs (0.2.6) daemon_controller (1.0.0) daemons (1.1.9) database_cleaner (0.8.0) devise (2.2.3) diff-lcs (1.1.3) erubis (2.7.0) eventmachine (1.0.0) execjs (1.4.0) fastthread (1.0.7) ffi (1.3.1) font-awesome-rails (3.0.2.0) highline (1.6.13) hike (1.2.1) i18n (0.6.1) journey (1.0.4) jquery-rails (2.0.2) json (1.7.6) less (2.2.1) less-rails (2.2.3) libv8 (3.3.10.4 x86_64-linux) listen (0.7.2) mail (2.4.4) mime-types (1.19) multi_json (1.5.0) mysql2 (0.3.11) nested_form (0.3.0) net-scp (1.0.4) net-sftp (2.0.5) net-ssh (2.5.2) net-ssh-gateway (1.1.0) orm_adapter (0.4.0) paperclip (3.1.4) passenger (3.0.14) pg (0.14.1) polyglot (0.3.3) rack (1.4.4) rack-cache (1.2) rack-ssl (1.3.3) rack-test (0.6.2) rails (3.2.3) railties (3.2.3) rake (10.0.3, 0.9.2.2) rb-inotify (0.8.8) rb-readline (0.4.2) rdoc (3.12) rmagick (2.13.1) rspec (2.11.0) rspec-core (2.11.1) rspec-expectations (2.11.1) rspec-mocks (2.11.1) rspec-rails (2.11.0) rubygems-bundler (1.0.3, 1.0.2) rvm (1.11.3.5, 1.11.3.3) sass (3.1.20) sass-rails (3.2.5) sprockets (2.1.3) therubyracer (0.10.1) thin (1.5.0) thor (0.14.6) tilt (1.3.3) treetop (1.4.10) twitter-bootstrap-rails (2.1.1) tzinfo (0.3.33) uglifier (1.2.6) warden (1.2.1) 

的Gemfile

 source 'https://rubygems.org' gem 'rails', '3.2.3' gem 'mysql2' #Devise Gem gem "devise", "~> 2.2.3" #for uploading files gem "paperclip", "~> 3.0" gem 'rmagick' #Nested Form gem "nested_form" #need this for rails 3 gem 'rb-readline' #Pagination gem 'will_paginate', '~> 3.0.0' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' gem 'less-rails' # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer', :platform => :ruby gem 'uglifier', '>= 1.0.3' end #js stuff: gem 'execjs' gem 'jquery-rails' gem 'twitter-bootstrap-rails' gem "font-awesome-rails" #gem to allow running on ubuntu server gem 'therubyracer' group :development do gem 'rails-dev-boost', :git => 'git://github.com/thedarkone/rails-dev-boost.git', :require => 'rails_development_boost' gem 'rb-inotify', '~> 0.8.8' end group :test, :development do gem 'rspec-rails' #adding database cleaner for tests gem 'database_cleaner' end # To use ActiveModel has_secure_password # gem 'bcrypt-ruby', '~> 3.0.0' group :production do gem 'thin' gem 'pg' end # Deploy with Capistrano gem 'capistrano' #run with passenger gem 'passenger' 

我得到的问题是部署应用程序时找不到will_paginate gem。 我是否正确地说,看起来我有两个gem试图在这里工作? 我不太确定,不想弄乱我的生产环境,所以最好在这个问题上得到一些建议

如果它在您的机器的开发环境中工作,那么我认为您应该将Gemfile.lock与代码一起推送并部署应用程序。 然后,生产环境中的“bundle install”也会安装与开发环境中相同的gem版本。

您需要在deploy.rb

 require "bundler/capistrano" set :bundle_cmd, '/path/to/bundle' 

所以bundler会自动安装所有必需的gem。

否则你需要手动完成。