2010-08-02 43 views
4

我有一个capistrano任务,它整合了Rails项目多个阶段的部署。从capistrano任务中调用多级capistrano任务

例如:

task :consolidated_task do 
    build #creates a new release branch from master, 
      #sets a variable with the relese branch name 

    staging 
    deploy.migrations 

    production 
    deploy.migrations 
end 

这是从另一个调用帽任务多级任务的正确方法?

构建任务创建一个新的git分支并发布它。新分支的名称被保存为capistrano变量。阶段和生产阶段任务然后使用这个变量来指定从哪个分支进行部署。

fatal: working tree '/Users/<my working directory>' already exists. 
/usr/local/lib/ruby/gems/1.8/gems/capistrano-2.5.19/lib/capistrano/recipes/deploy/strategy/copy.rb:99:in `initialize': No such file or directory - /var/folders/3d/3dKYNUwQGOSLZFXsMF-uv++++TM/-Tmp-/20100802182750/REVISION (Errno::ENOENT) 

我是从我的本地机器推源为Git仓库和部署机器无法相互通信:

当此任务运行时,它会失败。

+0

现在是100%。我一定是一个权力使用者! – manlycode 2010-08-03 12:49:14

回答

7

deploy:production:whatever 

任务名内盖暴露

deploy.production.whatever 

您还可以top命名空间去命名空间的顶部,因为路径是相对的。

因此,不管在哪个命名空间你的任务是目前你可以随时做thigs,如:

top.deploy.production.whatever