如何让杂物与捆绑器一起工作?
使用现有生产设置过渡到bundler。 天真地使用gemfile并设置如下:
gem "rails", "2.3.8" gem "mongrel", git: "http://github.com/dynamix/mongrel.git" bundle install --path /mnt/app/shared/bundle
从…开始
bundle exec mongrel_rails start --environment=production ...
结果是
/mnt/app/shared/bundle/ruby/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:166:in `require': no such file to load -- /mnt/services/shared/bundle/ruby/1.9.1/gems/mongrel-1.2.0.beta.1/lib/mongrel/init.rb (MissingSourceFile)
该怎么办?
为了回答我自己,因为我无法在网络上的其他地方找到正确的解决方案:
问题似乎是bundler
和mongrel
使用gem_plugin
。 是的,这些可能是生命支持但不幸的是很多人的生产配置仍然依赖于它们。
似乎从git
源安装了mongrel --pre
,它正在查看bundle/ruby/1.9.1/gems/mongrel_
而不是bundle/ruby/1.9.1/bundler/gems/mongrel_
这是bundler
器bundle/ruby/1.9.1/bundler/gems/mongrel_
gem的地方从git
克隆。
所以适用于我们配置的解决方案就是将它们符号链接:
ln -s /mnt/app/shared/bundle/ruby/1.9.1/bundle/gems/mongrel* \ /mnt/app/shared/bundle/ruby/1.9.1/gems/mongrel-1.2.0.beta.1
这显然是捆绑器可以自动完成的。 完整的例外情况是:
/mnt/app/shared/bundle/ruby/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:166:in `require': no such file to load -- /mnt/app/shared/bundle/ruby/1.9.1/gems/mongrel-1.2.0.beta.1/lib/mongrel/init.rb (MissingSourceFile) from /mnt/app/shared/bundle/ruby/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:166:in `require' from /mnt/app/shared/bundle/ruby/1.9.1/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:134:in `block in load' from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:241:in `each' from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:241:in `each' from /mnt/services/shared/bundle/ruby/1.9.1/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:112:in `load' from /mnt/app/shared/bundle/ruby/1.9.1/bundler/gems/mongrel-f3e69eb8e6fb/lib/mongrel/configurator.rb:231:in `load_plugins'