Bash scripts for Drupal, DDEV, and Tome

This website is made with Drupal. Local development is done with DDEV configured to use Orbstack for container management. The Tome Drupal module exports the dynamic site to a static site. Python is used to preview the site locally. Public hosting is provided free by Github.

Here are some custom bash aliases and functions I use to make common local tasks easy. Concurrently is used to run two processes in one terminal session.

alias brookemahoneycomCd='cd ~/Sites/brookemahoneycom'
brookemahoneycomLaunch () {
  # Starts Orbstack if it isn't running.
  orb
  brookemahoneycomCd
  cd drupal
  ddev launch
}

brookemahoneycomPreview () {
  brookemahoneycomCd
  cd docs
  concurrently 'python -m http.server' 'open "http://localhost:8000"'
}

brookemahoneycomBuild() {
  # Starts Orbstack if it isn't running.
  orb
  # Changes to the drupal directory.
  cd ~/Sites/brookemahoneycom/drupal
  # Clears caches.
  ddev drush cr
  # Exports the site with Tome.
  ddev drush tome:static --uri=https://brookemahoney.com
  # Removes old docs directory.
  rm -rf ~/Sites/brookemahoneycom/docs
  # Copies the Tome build directory to docs for Github hosting.
  cp -R ~/Sites/brookemahoneycom/drupal/html ~/Sites/brookemahoneycom/docs
  # Copies over static files, such as CNAME for Github hosting.
  cp -R ~/projects/brookemahoneycom/sync/ ~/Sites/brookemahoneycom/docs
}

All the code for the Drupal install is in this site's Github repo.

Tags
Drupal