Replacing a task in Capistrano / Capifony

1k Views Asked by At

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?

1

There are 1 best solutions below

0
On BEST ANSWER

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