ChromaticHQ / usher

Custom Robo commands for use on PHP projects.
https://packagist.org/packages/chromatic/usher
11 stars 6 forks source link

Fix DevelopmentModeCommands::databaseRefreshDdev() to be able to run inside docker container #204

Open apotek opened 5 months ago

apotek commented 5 months ago

Description

The only thing blocking being able to run robo isolated from the vagaries of our various host OS's is the DevelopmentModeCommands::databaseRefreshDdev command. Why? Because it attempts to run the ddev command, which can only be run on the OS level.

The fix here is to replace ddev import-db implementation with one that can run inside the container.

For example, here's the drush way to do it, and it works just as well.

drush sql:drop --uri=SITENAME --yes
zcat "$file" | drush sql:cli --uri=SITENAME

And then do the same with the other ddev drush... incantations.

Making these changes will allow the command to run within the container, meaning that the entire spin up and refresh sequence can be run regardless of host environment php versions, composer versions, shell versions, other dependencies.