In my capistrano recipe, I have a namespace with different tasks:
namespace :mystuff do task :mysetup do; ... end; task :mytask1 do; ... end; task :mytask2 do; ... end; task :mycleanup do; ... end; end
These customised tasks are triggered via lines like this at the top of my recipe:
after "deploy", "mystuff:mycleanup"
I want to execute a normal capistrano task from inside my namespace. For example, I want to automatically trigger the normal cleanup task if a certain number of release folders have built up:
task :mycleanup do;
if releases.length > 50
logger.info "Too many releases, runing deploy:cleanup."
deploy:cleanup #***THIS DOESN'T WORK***
end
end;
Unfortunately calling deploy:cleanup doesn’t work from inside my namespace. How can I execute deploy:cleanup?
Aha, the correct syntax is to use a
., not a:. i.e.deploy.cleanup, nodeploy:cleanup.This works: