capistrano失败 - cap部署在哪里定义?

时间:2010-12-15 14:16:41

标签: ruby-on-rails capistrano

我的cap deploy运行失败了,我认为这是因为格式化问题。这是一些输出:

* executing "rm -rf /var/www/cap-deploy/socialmit/releases/20101215141011/log /var/www/cap-deploy/socialmit/releases/20101215141011/public/system /var/www/cap-deploy/socialmit/releases/20101215141011/tmp/pids &&\\\n      mkdir -p /var/www/cap-deploy/socialmit/releases/20101215141011/public &&\\\n      mkdir -p /var/www/cap-deploy/socialmit/releases/20101215141011/tmp &&\\\n      ln -s /var/www/cap-deploy/socialmit/shared/log /var/www/cap-deploy/socialmit/releases/20101215141011/log &&\\\n      ln -s /var/www/cap-deploy/socialmit/shared/system /var/www/cap-deploy/socialmit/releases/20101215141011/public/system &&\\\n      ln -s /var/www/cap-deploy/socialmit/shared/pids /var/www/cap-deploy/socialmit/releases/20101215141011/tmp/pids"

(抱歉格式化。)

&&\\\n事情看起来很可疑,实际上将它们转储到我的控制台会导致输出`\ n:找不到命令。

是什么定义了cap deploy?看起来这个问题与它被定义为一个没有正确格式化的命令列表有关,导致了无关紧要的新行。但我找不到cap deploy的实际代码来修复它。它似乎不是特定于应用程序的东西,因为它不在我的Capfile或Capfile引用的任何文件中。

2 个答案:

答案 0 :(得分:1)

问题是一些名为after_symlink的用户定义任务必须在使用after("deploy:symlink", "deploy:new_name")语法的符号链接后重命名和调用:

问题:

namespace :deploy do
  desc "Symlink the upload directories"
  task :after_symlink do
    #run "mkdir -p #{shared_path}/uploads"
    run "ln -s #{deploy_to}/shared/db #{deploy_to}/#{current_dir}/db/link"
  end
end

错误(实际上是警告):

Deprecation Warning] Naming tasks with before_ and after_ is deprecated, please see the new before() and after() methods. (Offending task name was after_update_code)
[Deprecation Warning] Naming tasks with before_ and after_ is deprecated, please see the new before() and after() methods. (Offending task name was after_symlink)

正确的做法:

namespace :deploy do
  desc "Symlink the upload directories"
  task :link_db do
    #run "mkdir -p #{shared_path}/uploads"
    run "ln -s #{deploy_to}/shared/db #{deploy_to}/#{current_dir}/db/link"
  end
end

after("deploy:symlink", "deploy:link_db")

\\\n业务的问题是我的误诊。显然执行得很好。

答案 1 :(得分:0)

部署任务在gem here中定义。

我会说这很可能不是问题所在。部署失败时会引发什么错误?