ddev / ddev-contrib

Contrib space for DDEV services, tools, snippets, and approaches.
Apache License 2.0
162 stars 162 forks source link

[WIP] Add 'refresh' script for (re)initializing/resetting Drupal environment #203

Closed hawkeyetwolf closed 1 year ago

hawkeyetwolf commented 2 years ago

The Problem:

Cleaning up/initializing your Drupal environment to begin new work, or switching branches to test someone else's work, requires several steps. It's easy to forget some of them, and it takes cognitive load to remember. Lots of folks write a little custom bash alias/script to handle it for them on a given project. This is just a very complete version of that, and can be used on most Drupal projects.

The steps required to refresh a Drupal environment include:

How this PR Solves The Problem:

Provides a single command to completely (re)initialize/refresh your ddev Drupal environment. Supports various flags to turn steps on and off. See README.md for the full list of options. This command is especially useful when collaborating with other developers or otherwise switching between branches for testing.

Manual Testing Instructions:

  1. Create a ddev Drupal environment. You can follow the Drupal.org documentation, or use an existing site you have.

  2. Copy the refresh script into place: .ddev/commands/host/refresh

  3. Also install the drupal-login and gulp custom commands from ddev-contrib.

  4. Run ddev refresh, and see that all the default steps run.

  5. Run ddev refresh some-existing-branch and see that an existing branch is checked out + pulled before refreshing.

  6. Run ddev refresh -h and see all the options available. Try out some them. E.g., --no-restart to skip restarting ddev, and --no-login to skip the login step at the end.

  7. The only two steps you can't (easily) test are --import-db and --existing-sql to download and import a database dump from some upstream environment, as those are usually project specific and require some extra setup to use. Since they don't run by default, I chose to leave them in place for users to leverage if they wish.

Manual Testing Environments:

hawkeyetwolf commented 2 years ago

Thank you @rfay!! And apologies for not following the contribution guidelines... I was trying out this newfangled GitHub Codespaces thing, and it auto-created the PR for me. Will update the PR description later.

rfay commented 2 years ago

All good, thanks!

hawkeyetwolf commented 2 years ago

I decided to take out the dependency on Drainpipe, so I need to do some more testing locally to make sure all the steps still work. Marking PR as WIP draft.

rfay commented 2 years ago

Did you get this to where you wanted it? If so, please mark ready for review.

rfay commented 1 year ago

No response from OP. Happy to reopen when you're ready to mark it ready for review.