Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capistrano 3 Before and After Hooks

I just switched to using Capistrano 3 and ran into some issues with the before and after hooks documentation.

In the docs it show the following for calling existing tasks

before :starting, :ensure_user
after :finishing, :notify

If I use this syntax I get 'Don't know how to build task starting' Instead I had to do the following to get my tasks to work.

before "deploy:starting", "dj:stop"
after "deploy:finished", "dj:start"

The dj tasks are in Capistrano tasks directory in a *.rake file. Any ideas on what I may be missing or do the docs need to be updated?

Ruby 2.1.6 Rails 4.2.0 Capistrano 3.4.0

like image 839
Nvick Avatar asked Apr 21 '15 16:04

Nvick


1 Answers

You can only use the shortcut version (before :starting, :ensure_user) when both tasks are inside the same namespace. When you want to execute tasks from different namespaces, you need to include the namespace inside the string (before "deploy:starting", "dj:stop").

like image 108
marcus3006 Avatar answered Oct 17 '22 23:10

marcus3006