Created
August 20, 2018 09:23
-
-
Save amtrack/96cb724ebb06b9e11af68b172f9c4048 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env bash | |
# Usage: | |
# RETRIEVE_SPLIT_PATTERNS='PermissionSet/*,' bash force-dev-tool-retrieve-splitted.sh | |
# | |
# where RETRIEVE_SPLIT_PATTERNS expects a comma separated list of Metadata Component Patterns. | |
RETRIEVE_SPLIT_PATTERNS="${RETRIEVE_SPLIT_PATTERNS:-""}" | |
IFS=',' read -ra retrieveSplitPatterns <<< "$RETRIEVE_SPLIT_PATTERNS" | |
if [[ ${#retrieveSplitPatterns[@]} -gt 0 ]] && force-dev-tool package grep "${retrieveSplitPatterns[@]}" > /dev/null; then | |
echo "Splitting package.xml into config/deployments/retrieve-splitted to be retrieved separatedly." | |
echo "" | force-dev-tool changeset create -f retrieve-splitted > /dev/null | |
force-dev-tool package grep "${retrieveSplitPatterns[@]}" | xargs -0 force-dev-tool package -f config/deployments/retrieve-splitted/package.xml add > /dev/null | |
force-dev-tool package remove "${retrieveSplitPatterns[@]}" > /dev/null | |
force-dev-tool retrieve "$@" | |
force-dev-tool retrieve -d config/deployments/retrieve-splitted "$@" | |
echo "Merging config/deployments/retrieve-splitted back to src directory" | |
find config/deployments/retrieve-splitted -mindepth 1 -type d -exec cp -r {} src/ \; | |
force-dev-tool package -f config/deployments/retrieve-splitted/package.xml list | xargs -0 force-dev-tool package add > /dev/null | |
else | |
force-dev-tool retrieve "$@" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment