我是第一次使用Capistrano部署应用程序,这是我在Rails 4 / Capistrano中的第一个应用程序,在lib文件夹中有一个自定义类。
我在部署时收到以下错误:
* executing "cd -- /u/apps/focus/releases/20130917152233 && RAILS_ENV=production RAILS_GROUPS=assets bundle exec rake assets:precompile"
servers: ["focus"]
[focus] executing command
*** [err :: focus] rake aborted!
*** [err :: focus] cannot load such file -- VSphere
*** [err :: focus] /u/apps/focus/shared/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
*** [err :: focus] /u/apps/focus/shared/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
*** [err :: focus] /u/apps/focus/shared/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
*** [err :: focus] /u/apps/focus/shared/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
*** [err :: focus] /u/apps/focus/releases/20130917152233/lib/tasks/usage.rake:3:in `block in <top (required)>'
*** [err :: focus] /u/apps/focus/releases/20130917152233/lib/tasks/usage.rake:1:in `<top (required)>'
*** [err :: focus] /u/apps/focus/shared/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
*** [err :: focus] /u/apps/focus/shared/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
*** [err :: focus] /u/apps/focus/shared/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
*** [err :: focus] /u/apps/focus/shared/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
*** [err :: focus] /u/apps/focus/shared/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/engine.rb:641:in `block in run_tasks_blocks'
*** [err :: focus] /u/apps/focus/shared/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/engine.rb:641:in `each'
*** [err :: focus] /u/apps/focus/shared/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/engine.rb:641:in `run_tasks_blocks'
*** [err :: focus] /u/apps/focus/shared/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/application.rb:244:in `run_tasks_blocks'
*** [err :: focus] /u/apps/focus/shared/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/engine.rb:446:in `load_tasks'
*** [err :: focus] /u/apps/focus/shared/bundle/ruby/1.9.1/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
*** [err :: focus] /u/apps/focus/releases/20130917152233/Rakefile:6:in `<top (required)>'
*** [err :: focus] (See full trace by running task with --trace)
command finished in 4490ms
*** [deploy:update_code] rolling back
我有一个名为usage.rake的rake文件,它需要VSphere库位于任务的顶部:
namespace :usage do
desc "Tasks related to the usage application"
require 'VSphere'
..snip..
end
所以我理解我的rake任务需要这个文件,当我在开发中运行rake任务时它可以正常工作。
所以有两个问题:
假设答案#1:我相信资产管道正在查看我的rake任务的require语句,因为它可能包含可以预编译的javascript或样式表。在这种情况下,它没有。我仍然在寻找一种方法来避免这种依赖性&#39;或者将资产管道指向自定义库的正确方向。
任何指导将不胜感激! 谢谢!
修改:澄清了两个问题,并消除了与其他依赖关系的混淆。
答案 0 :(得分:0)
事实证明这比我想象的要简单得多。正如the rails repo on github中所指出的,我的require语句是针对特定于大写的“vsphere”文件,而不是“VSphere”。