Capistrano 3 Before and after hooks

I simply switched to using Capistrano 3 and ran into some documentation problems before and after interception.

In documents, it displays the following for invoking existing tasks

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

If I use this syntax, I get “I don’t know how to create a task, starting”, Instead I had to do the following for my tasks to work.

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

The dj tasks are located in the Capistrano task directory in the * .rake file. Any ideas on what I can lose or make documents need to be updated?

Ruby 2.1.6 Rails 4.2.0 Capistrano 3.4.0

+7
ruby ruby-on-rails capistrano capistrano3
source share
1 answer

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

+11
source share

All Articles