2013-02-16 87 views
0

我试图在vexxhost上首次部署我的rails应用程序。我使用github作为我的源代码管理和capistrano。一旦我安装了capistrano,Rails应用程序无法加载

这里是我的部署文件

require 'bundler/capistrano' 
require 'capistrano' 
require 'bundler' 
require 'capistrano-vexxhost' 

# Account Settings 

ssh_options[:forward_agent] = true 
set :scm_command, "/home/user/opt/bin/git" 
set :local_scm_command,"git" 
set :user, "xxxxxxxx" 
set :password, "xxxxxxxxx" 
set :domain, "domain.com" 
set :mount_path,"/home/xxxxxxxx/xxxxxxx" 
set :application,"app name" 
set :scm, :git 
set :deploy_via, :copy 
set :repository, "[email protected]:xxxxx/xxxxxxx.git" 
default_run_options[:pty] = true 

当我安装了宝石“Capistrano的”宝石“Capistrano的-vexxhost”我得到试图在本地加载在我的笔记本电脑我的应用程序时出现以下错误(这是工作在安装capistrano之前)。

C:/Ruby193/lib/ruby/gems/1.9.1/gems/capistrano-2.14.1/lib/capistrano/configuration/loading.rb:18:in `instance': Please require this file from within a Capistrano recipe (LoadError) 
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/capistrano.rb:7:in `<top (required)>' 
    from C:/Users/mummy/LagoAds/config/application.rb:6:in `require' 
    from C:/Users/mummy/LagoAds/config/application.rb:6:in `<top (required)>' 
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:53:in `require' 
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:53:in `block in <top (required)>' 
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap' 
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `<top (required)>' 
    from script/rails:6:in `require' 
    from script/rails:6:in `<main>' 

注意但正如我只要我从application.rb中文件下面的代码注释的Bundler.require线,它成功运行,但不承认宝石

if defined?(Bundler) 
# If you precompile assets before deploying to production, use this line 
Bundler.require(*Rails.groups(:assets => %w(development test))) 
# If you want your assets lazily compiled in production, use this line 
# Bundler.require(:default, :assets, Rails.env) 
end 

UPDATE

当我输入以下代码“耙--trace”这也给了我下面的错误

rake aborted! 
please require the file from withen a capistrano recipe 

请我需要帮助解决这个问题

回答

15

,如果你把capistrano*宝石到Gemfile你需要禁用自动要求:

gem 'capistrano-vexxhost', :require => false 
+0

感谢您的回答,我想你的建议,但我仍然得到了同样的错误。我认为这个问题与BUNDLER有关,因为当我注释掉“Bundler.require(* Rails.groups(:assets =>%w(开发测试)))”从application.rd开始工作,但它没有工作, t加载宝石。 – 2013-02-16 11:00:48

+0

你有没有把这个添加到所有'capistrano'相关的宝石? – mpapis 2013-02-16 13:34:07

+0

yayyy !!!你是对的。它现在有效。但我想知道,什么是“:require => false”,我希望它不会影响我部署到剪切服务器。 – 2013-02-16 16:59:01

相关问题