开发者

Calling a multistage capistrano task from within a capistrano task

I have a capistrano task that consolidates the deployment of multiple stages of a Rails project.

For example:

task :consolidated_task do
    build #creates a new release branch fro开发者_JAVA百科m master, 
          #sets a variable with the relese branch name

    staging
    deploy.migrations

    production
    deploy.migrations
end

Is this the proper way to call a multistage task from another cap task?

The build task creates a new git branch and published it. The name of the new branch gets saved as a capistrano variable. the staging and production stage tasks then use this variable to specify what branch to deploy from.

When this task runs, it fails with:

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)

I'm pushing the source from my local machine as the git repository and the deployment machine cannot communicate with each other.


Task names like

deploy:production:whatever

are exposed within Cap as

deploy.production.whatever

You also have top namespaces to go to the top of the namespaces, because the paths are relative.

So, no matter in which namespace your task currently is you can always do thigs like:

top.deploy.production.whatever
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜