Created
August 8, 2020 07:45
-
-
Save hotwebmatter/d534f150c534486007bea57927971ba6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# features-utils.sh | |
# Perform bulk operations on Drupal Features modules in Lando environments. | |
# Configuration | |
# Replace [features_bundle] with your features bundle. | |
# Replace [dev_alias] with the Drush alias for your Dev environment. | |
# Replace [stage_alias] with the Drush alias for your Stage environment. | |
# Notes | |
# To use without Lando, change "lando drush" to "drush" (requires local Drush.) | |
# Do not use Features to deploy config to Production post-launch; use config sync. | |
# fd | |
# Disable Features in local only. | |
function fd() { | |
if [[ $# -eq 0 ]]; then | |
echo "fd (features-disable)" | |
echo "Usage: fd foo [bar baz ...]" | |
echo "Executes lando drush pmu [features_bundle]_foo" | |
fi | |
for feature in "$@"; do lando drush pmu [features_bundle]_$feature; done; | |
} | |
# fe | |
# Enable (fe) Features in local only. | |
function fe() { | |
if [[ $# -eq 0 ]]; then | |
echo "fe (features-enable)" | |
echo "Usage: fd foo [bar baz ...]" | |
echo "Executes lando drush en [features_bundle]_foo" | |
fi | |
for feature in "$@"; do lando drush en [features_bundle]_$feature; done; | |
} | |
# fl | |
# List [local|dev|stage] for comparison. | |
function fl() { | |
if [[ $# -eq 0 ]]; then | |
echo "fl (features-list)" | |
echo "Usage: fl [local|dev|stage]" | |
echo "Lists [features_bundle] features in target environment" | |
fi | |
for environment in "$@"; do | |
echo "Environment: " $environment | |
if [[ "$environment" == "local" ]]; then | |
lando drush pml |grep [features_bundle] | |
elif [[ "$environment" == "dev" ]]; then | |
lando drush [dev_alias] pml |grep [features_bundle] | |
elif [[ "$environment" == "stage" ]]; then | |
lando drush [stage_alias] pml |grep [features_bundle] | |
else | |
echo " Unknown environment. Use [local|dev|stage]" | |
fi | |
lando drush $environment |grep [features_bundle] | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment