Skip to content

Commit 473df4d

Browse files
author
David Ferlay
committed
Adding make split list command
1 parent 5a8fd16 commit 473df4d

File tree

4 files changed

+49
-3
lines changed

4 files changed

+49
-3
lines changed
File renamed without changes.

scripts/multisite/config_split.mk

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,27 @@ split:
1313

1414
# Message if no argument passed
1515
ifeq ($(ARGS),)
16-
@echo "\nMachine name of split to enable is expected as argument \nFor exemple : \n - make split first // To enable first split\nor\n - make split default // To enable default config with no split\n"
16+
@printf "\nMachine name of split to enable is expected as argument \nFor exemple : \n - make split SPLIT_MACHINE_NAME // To enable SPLIT_MACHINE_NAME split\nor\n - make split default // To enable default config with no split\nor\n - make split list // To list available splits\n"
17+
@printf "\n"
1718
@exit 1
1819
else
19-
@echo "YAY $(ARGS)"
2020

21+
# List available splits
22+
ifeq ($(ARGS),list)
23+
ifneq ("$(wildcard scripts/makefile/config_split_list_all.sh)","")
24+
@$(call php, /bin/sh ./scripts/makefile/config_split_list_all.sh)
25+
else
26+
@echo "- scripts/makefile/config_split_list_all.sh file does not exist"
27+
@exit 1
28+
endif
29+
@exit 1
30+
else
31+
32+
# Split is found
33+
@echo "YAY $(ARGS)"
2134
# Disabling all active splits
2235
@echo "Disabling all active splits:"
2336
ifneq ("$(wildcard scripts/makefile/config_split_disable_all.sh)","")
24-
@echo "- Script found : Executing..."
2537
@$(call php, /bin/sh ./scripts/makefile/config_split_disable_all.sh)
2638
else
2739
@echo "- scripts/makefile/config_split_disable_all.sh file does not exist"
@@ -35,6 +47,8 @@ ifeq ($(ARGS),default)
3547
else
3648
@$(call php, drush config-set config_split.config_split.$(ARGS) status 1 -y)
3749
endif
50+
endif
51+
endif
3852

3953
# Executing the rest of deploy commands
4054
@echo "Importing $(ARGS) config..."

scripts/multisite/config_split_disable_all.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ if [ "$CONFIG_COUNT" -gt "0" ]; then
2727
else
2828
printf "- \033[1mNo split of config was\033[0m found\n"
2929
fi
30+
31+
echo -e "- Clearing cache..."
32+
drush cr
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env sh
2+
3+
# Parsing command
4+
PARSING_CMD='echo drush config:status --state=Any --format=list'
5+
6+
# Entity to parse (see PARSING_CMD for more)
7+
CONFIG_TO_PARSE=config_split.config_split
8+
9+
# Count entities
10+
CONFIG_COUNT=$($($PARSING_CMD) | grep -c $CONFIG_TO_PARSE)
11+
12+
# List entities
13+
CONFIG_LIST=$($($PARSING_CMD) | grep $CONFIG_TO_PARSE | awk -F "." '{print $3}')
14+
15+
16+
# Looking for splits
17+
18+
if [ "$CONFIG_COUNT" -gt "0" ]; then
19+
20+
echo -e "- The following splits are available : "
21+
22+
for bundles in $CONFIG_LIST; do
23+
echo " - $bundles"
24+
done
25+
printf "\n"
26+
27+
else
28+
printf "- \033[1mNo split of config was\033[0m found\n"
29+
fi

0 commit comments

Comments
 (0)