0

在整个开发过程中,我一直在研究cap deploy我的应用程序,最后一次尝试部署它时,它没有用。这是发生的事情:

  * executing `deploy:assets:precompile'
  * executing "cd /var/www/oneteam/releases/20121006153136 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
    servers: ["electricsasquatch.com"]
    [electricsasquatch.com] executing command
 ** [out :: electricsasquatch.com] rake aborted!
 ** [out :: electricsasquatch.com] uninitialized constant OneTeam::Application::FactoryGirl
 ** [out :: electricsasquatch.com] 
 ** [out :: electricsasquatch.com] (See full trace by running task with --trace)

看起来它在deploy:assets:precompile命令上失败了。不过,我不明白为什么该命令会尝试对 FactoryGirl 做任何事情。有任何想法吗?

4

2 回答 2

0

不是deploy:assets:precompile任务有问题,而是使用 FactoryGirl 的 rake 任务有问题。即使您放置语法错误,让我们说,lib/tasks/first.rake并且您执行任务lib/tasks/second.rake,例如rake secondrake 会以rake aborted!. 甚至rake -T不会工作。所以有一个 rake 任务正在尝试使用 FactoryGirl 但不包括 FactoryGirl。

于 2012-10-06T17:03:06.270 回答
0

我有这个config/application.rb

FactoryGirl.define do
  sequence(:random_string) { |s| ('a'..'z').to_a.shuffle[0, 30].join }
end 

我把它改成这样:

if Rails.env != "production"
  FactoryGirl.define do
    sequence(:random_string) { |s| ('a'..'z').to_a.shuffle[0, 30].join }
  end 
end 

问题消失了。

于 2012-10-31T15:57:06.433 回答