ruby-on-rails - 乘客错过了生产环境中的开发 gem

标签 ruby-on-rails rubygems passenger bundler environment

我的生产服务器上有一个奇怪的行为:我通过 Capistrano 将 Rails 3 应用程序部署到生产服务器。 Capistrano 脚本在部署结束时重新启动乘客。当我打开应用程序时,我看到一条乘客错误消息:

Could not find autotest-fsevent-0.2.4 in any of the sources
(Bundler::GemNotFound)

当然我的生产环境中没有安装autotest-fsevent(甚至在Ubuntu上也无法安装...)

环境在apache的virtualhost中设置:

<VirtualHost *>
  PassengerMinInstances 1

  ServerName test.myapp.de
  DocumentRoot /var/www/myapp/current/public

  RailsEnv production
  RackEnv production

  <Directory /var/www/myapp/current/public/>
    Options -Indexes
    AllowOverride None
    Order deny,allow
    Deny from none
    Allow from all
    AddOutputFilterbyType DEFLATE text/html
    FileEtag none
  </Directory>

  LogLevel warn
  ErrorLog /var/www/myapp/shared/log/error.log
  CustomLog /var/www/myapp/shared/log/access.log combined

</VirtualHost>

这是我的 Gemfile:

source 'http://rubygems.org'

gem 'rails', '3.0.6'
gem 'jquery-rails'

gem 'mysql'
gem 'simple-navigation'
gem 'geokit'
gem 'geokit-rails3', :git => "git://github.com/loosecubes/geokit-rails3.git"
gem 'validates_timeliness', '~> 3.0.2'
gem 'delocalize'
gem 'prawn'

group :development do
gem 'rspec-rails', '2.5.0'
gem 'faker', '0.3.1'
#gem 'ruby-debug19'
gem 'ruby-debug'
gem 'autotest', '4.4.6'
gem 'autotest-rails-pure', '4.1.2'
gem 'autotest-fsevent', '0.2.4'
gem 'autotest-growl', '0.2.9'
end

group :test do
  gem 'rspec', '2.5.0'
  gem 'rcov'
  gem 'webrat', '0.7.1'
  gem 'factory_girl_rails', '1.0'
end

为什么乘客(或 bundle 者)认为它需要所有 gem,而不是仅生产环境的 gem?

感谢您的帮助!

最佳答案

您是否使用 bundler capistrano 食谱?

确保它位于您的config/deploy.rb

require 'bundler/capistrano'

基本上,它将使用--withoutdevelopmenttest选项调用bundle,该选项应该只安装生产gems。如果您只是做一个常规的 bundle ,它将安装尝试为所有环境安装gems。

关于ruby-on-rails - 乘客错过了生产环境中的开发 gem ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6200931/

相关文章:

ruby-on-rails-3 - 在 Linode 上托管 Rails 应用程序

ruby-on-rails - Apache 上的 Phusion 乘客 : Could not spawn process for group

ruby-on-rails - Devise 中两种截然不同的用户模型

ruby-on-rails - 在新的 MacBookPRO M1 上运行 `gem install bundler` 时出现 SSL 验证错误

ruby-on-rails - rails : 'Load More' button with Ajax & Kaminari

javascript - 无法使用 Rails 3.0 的 best-in-place gem 编辑记录

ruby-on-rails - 生产中的 bundler 不会忽略开发和测试 gem

ruby-on-rails - ruby rails : Unable to sign out of application in production

mysql - 让 mysql gem 在 rvm 上与 ruby​​-1.9.3 一起使用

sinatra - 没有此类文件可加载 Passenger 和 Sinatra