Open JanTvrdik opened 7 years ago
I will never want to solve something just a little complicated :-) So feel free to suggest PR, issues will not work.
I hope that @CZechBoY will do it.
I propose the following approach to the problem:
After install or update store the current cleaner-ignore configuration somewhere in vendor
directory.
Next time in beforeInstall / beforeUpdate event compare it and rm -rf directories of packages for which cleaner-ignore definition changed.
@JanTvrdik so folders are never removed but only moved to some subdirectory in vendor? I don't think that this is goal of this library.
There should be some force reinstall command in composer... then for each ignored library (with not found ignored directories) should be then reinstalled and cleaned again.
@CZechBoY No, that's not what @JanTvrdik meant. Only the configuration file for cleaner should be stored somewhere. That way you can figure out the changes in the configuration when you do the next clean and remove the directories with packages that need reinstallation. That way you'll force intalling it again.
@enumag ah, so save last composer.json (or at least the cleaner part) for later comparison. next update/install it should compare this old and current configuration and force reinstall of packages as mentioned in my previous message.
I don't know if this can actually be solved but I think it's worth looking into. Currently if cleaner removed too much stuff, you modify cleaner-ignore. Calling
composer update
/composer update
however does not restore the deleted files.It would be nice if composer-cleaner could detect that cleaner-ignore was changed and force Composer to reinstall the library.