Deployer: Unset task?

Created on 18 Oct 2015  路  11Comments  路  Source: deployphp/deployer

So if Im fx using the symfony recipe, and there is 1 task I dont want to be executed, is there any method to "unset" this task?

Actually it is the assetic task I dont want to run (I dont use assetic), so this task

task('deploy:assetic:dump', function () {

    run('php {{release_path}}/' . trim(get('bin_dir'), '/') . '/console assetic:dump --env={{env}} --no-debug');

})->desc('Dump assets');

I want to not run.

Ofcourse I could copy the whole symfony recipe and then removing this 1 task and use that instead - but it seems like over doing it.

Most helpful comment

This is good idea! We need API for removing tasks.

All 11 comments

Hi Martin,

May be I'm wrong, but I don't think it's possible to remove a task.
However, you can override it with an empty function. For example:

task('deploy:assetic:dump', function () {});

This line must be set _after_ 'require 'recipe/symfony.php'

++

Current deployer don't support removing a task, but you can override it as @tmarly 's comment.

task('deploy:assetic:dump', function () {})->setPrivate();

This is good idea! We need API for removing tasks.

2020 and still not done lol

@patwebrussell 2020 and some people not contributing, lol.

It does not help that the topic was closed anyway hehe

I can disagree. Clearing issues is really helping me with prioritizing work. If somebody still interesting in this feature - open a discussion or send a PR.

We could probably do something like

task('deploy:assetic:dump')->unsetTask();
And that would do a
task('deploy:assetic:dump', function () {});
behind the seen

It's about the same amount of characters but it would look a lot cleaner in the deployer.php code in my opinion

What's your thoughts?

Maybe disable()?

Any progress on this? Currently wanting to disable some tasks from the laravel recipe as they are not available for lumen - as there is no lumen recipe

I've found a dirty way: task('artisan:config:cache')->onStage(null); -> just set a filter with value null disables the task

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dima-stefantsov picture dima-stefantsov  路  4Comments

jolipixel picture jolipixel  路  4Comments

krve picture krve  路  4Comments

timkley picture timkley  路  4Comments

exts picture exts  路  3Comments