Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replacing a task in Capistrano / Capifony

I am using Capifony, a Symfony-specific extension to Capistrano. I need to override one of the pre-defined tasks so my own symfony task is run - replacing task :permissions in https://github.com/everzet/capifony/blob/master/lib/symfony1.rb#L180 with my own.

I have tried adding the following to the end of my deploy.rb file, but Capistrano doesn't pick it up, and it uses the already defined task instead:

namespace :project do
  desc "Fixes symfony directory permissions using Citizencard custom permission setter"
  task :permissions do
    run "cd #{latest_release} && #{php_bin} ./symfony citizencard:permissions"
  end
end

How can I do this?

like image 828
PeterB Avatar asked Mar 05 '26 10:03

PeterB


1 Answers

I hadn't dug deep enough into the namespace stack. Changing my code to the following made it work:

  namespace :symfony do
    namespace :project do
      desc "Fixes symfony directory permissions using Citizencard custom permission setter"
      task :permissions do
        run "cd #{latest_release} && #{php_bin} ./symfony citizencard:permissions"
      end
    end
  end
like image 79
PeterB Avatar answered Mar 07 '26 05:03

PeterB