wunderio / ddev-drupal

Work in progress of template for DDEV Drupal projects
0 stars 0 forks source link

#9 Create pmu tooling (drush pmu) wrapper initial script. #10

Closed hkirsman closed 4 months ago

hkirsman commented 4 months ago

Overview

During development there are cases when you are in a state where module code is gone, but db still requires it to continue. To fix it, you'll have to either put the module back or in my case I've created dummy small module (info file) and then run pmu. This PR is about autoamating the dummy module creation if needed.

Current solutions logic:

  1. The command is ddev pmu module_name because we are used to pmu (I think? Maybe some use the longer version?)
  2. It looks for the module_name from contrib, custom and core module folders.
  3. If it doesn't find it, then it'll create dummy module under custom and clear caches
  4. It then proceeds to run drush pmu
  5. After it's done, it removes the dummy module.
  6. If in step 2 it finds module, then it skips creating dummy module and just run drush pmu

Testing

Install the version from current branch:

1.

ddev composer require wunderio/ddev-drupal:dev-feature/9-Create-wrapper-for-pmu-to-be-able-to-uninstall-modules-that-dont-exist-in-code --dev
  1. Remove some module from your code.

  2. Try to uninstall the module with drush ddev drush pmu your_module. It should yell about missing module and it can't proceed. image

  3. Remove the module with new command ddev pmu your_module.

hkirsman commented 4 months ago

I've applied feedback from Ragnar with last commit. Now it also accepts multiple module names separated by spaces.