Does deploy_to work differently in Capistrano 3 vs Capistrano 2?

228 views
Skip to first unread message

Silumesii Maboshe

unread,
Feb 6, 2014, 7:18:10 AM2/6/14
to capis...@googlegroups.com
Hello!

I'm experimenting the Capistrano 3 with the Bedrock WordPress Stack (http://roots.io/wordpress-stack/).

When using Rails, Capistrano 2 and the multi-stage extension , deploy_to would deploy an application to the deploy_to path with the stage.
For example:
set :deploy_to, "/var/www/my_app"
Deploys to:
/var/www/my_app/STAGE_NAME

With Capistrano 3 and Bedrock, it seems deploy to does not append the stage name.
For example:
set :deploy_to, "/var/www/my_app"
Deploys to:
/var/www/my_app

I got used to having the stage name appended in Capistrano 2 and could not help but notice it seems to be missing in Capistrano 3. Is this the expected behaviour in Capistrano 3?

Thank you,

Silumesii

Lee Hambley

unread,
Feb 6, 2014, 8:13:44 AM2/6/14
to capistrano
Something weird was happening with your Capistrano 2 setup, somewhere along the line someone was appending the stage pseudo variable to the deploy_to variable.

In Capistrano 3 (as with Capistrano 2) you can achieve the same bahaviour with:

set :deploy_to, ->() { "/var/www/my_app" + fetch(:stage) }

​The documentation covering this for Capistrano 2 can be found here. In Capistrano 3 it's not explicitly documented as the generated example templates ​include some examples, and it's a neat trick of Ruby more than of Capistrano. The proc/lambda causes execution to be delayed until the block of code contained therein is called. When using fetch() in Capistrano (2 and 3) the result is checked to see if it responds to #call(), if it does the process is repeated and it doesn't respond to call anymore, there's an open issue there being tracked here: https://github.com/capistrano/capistrano/pull/872.

​So, to make a long story short, no behaviour changed, but you've overlooked a bit of your old Capistrano 2 config that might have been setup by someone else, or might have syntax you didn't recognise.​

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/21379555-6a75-437e-b42b-2f8ccb8f017d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Silumesii Maboshe

unread,
Feb 6, 2014, 8:43:19 AM2/6/14
to capis...@googlegroups.com
Thank you!

Silumesii
Reply all
Reply to author
Forward
0 new messages