Skip to content

Instantly share code, notes, and snippets.

@iamntz
Created January 1, 2024 07:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamntz/499478074504a9727569a664c54055fb to your computer and use it in GitHub Desktop.
Save iamntz/499478074504a9727569a664c54055fb to your computer and use it in GitHub Desktop.
quickly update bedrock-related files
#!/bin/bash
## Description: Update bedrock packages
## Usage: update-bedrock [wp|plugins|themes]
## Example: "ddev update-bedrock" or "ddev update-bedrock wp" or "ddev update-bedrock plugins" or "ddev update-bedrock themes"
## ExecRaw: true
## HostWorkingDir: true
case $1 in
wp)
what='roots/'
;;
plugins)
what='wpackagist-plugin/'
;;
themes)
what='wpackagist-theme/'
;;
*)
what='(wpackagist-theme|wpackagist-plugin|roots)/'
;;
esac
__packages=$(composer show -s | sed -n '/requires$/,/^$/p' | cut -d ' ' -f1)
IFS=$'\n' read -ra packages -d $'\0' <<< "$__packages"
toUpdate=''
for package in "${packages[@]}"
do
if [[ "$package" =~ ^$what.* ]]; then
toUpdate="$toUpdate $package"
fi
done
composer require $toUpdate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment