Skip to content

Commit e5a43dc

Browse files
authored
[#2351] Added per-step timing to 'task()' and 'pass()' functions. (#2473)
1 parent 20e96ca commit e5a43dc

77 files changed

Lines changed: 377 additions & 250 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vortex/docs/.utils/update-installer-video.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ INSTALLER_BUILD="${PROJECT_ROOT}/.vortex/installer/build/installer.phar"
4141
INSTALLER_SOURCE_DIR="${PROJECT_ROOT}/.vortex/installer"
4242

4343
# Logging functions
44-
note() { printf " %s\n" "${1}"; }
4544
info() { echo -e "\033[0;34m[INFO]\033[0m $1" >&2; }
45+
note() { printf " %s\n" "${1}"; }
4646
pass() { echo -e "\033[0;32m[ OK ]\033[0m $1" >&2; }
4747
fail() { echo -e "\033[0;31m[FAIL]\033[0m $1" >&2; }
4848

.vortex/docs/content/contributing/maintenance/script-boilerplate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ VORTEX_EXAMPLE_URL="${VORTEX_EXAMPLE_URL:-http://example.com}"
1515
# ------------------------------------------------------------------------------
1616

1717
# @formatter:off
18-
note() { printf " %s\n" "${1}"; }
1918
info() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[34m[INFO] %s\033[0m\n" "${1}" || printf "[INFO] %s\n" "${1}"; }
19+
note() { printf " %s\n" "${1}"; }
2020
pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[32m[ OK ] %s\033[0m\n" "${1}" || printf "[ OK ] %s\n" "${1}"; }
2121
fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; }
2222
# @formatter:on

.vortex/docs/content/drupal/provision-example.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ set -eu
2020
# ------------------------------------------------------------------------------
2121

2222
info() { printf " ==> %s\n" "${1}"; }
23-
task() { printf " > %s\n" "${1}"; }
2423
note() { printf " %s\n" "${1}"; }
24+
task() { printf " > %s\n" "${1}"; }
2525

2626
drush() { ./vendor/bin/drush -y "$@"; }
2727

.vortex/installer/tests/Fixtures/handler_process/_baseline/scripts/custom/provision-10-example.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ set -eu
2020
# ------------------------------------------------------------------------------
2121

2222
info() { printf " ==> %s\n" "${1}"; }
23-
task() { printf " > %s\n" "${1}"; }
2423
note() { printf " %s\n" "${1}"; }
24+
task() { printf " > %s\n" "${1}"; }
25+
pass() { printf " < %s\n" "${1}"; }
26+
fail() { printf " ! %s\n" "${1}"; }
2527

2628
drush() { ./vendor/bin/drush -y "$@"; }
2729

@@ -36,19 +38,24 @@ if echo "${environment}" | grep -q -e dev -e stage -e ci -e local; then
3638

3739
task "Setting site name."
3840
drush php:eval "\Drupal::service('config.factory')->getEditable('system.site')->set('name', 'star wars')->save();"
41+
pass "Set site name."
3942

4043
task "Installing contrib modules."
4144
drush pm:install admin_toolbar coffee config_split config_update media environment_indicator pathauto redirect reroute_email robotstxt shield stage_file_proxy xmlsitemap
45+
pass "Installed contrib modules."
4246

4347
task "Installing Redis module."
4448
drush pm:install redis || true
49+
pass "Installed Redis module."
4550

4651
task "Installing and configuring ClamAV."
4752
drush pm:install clamav
4853
drush config-set clamav.settings mode_daemon_tcpip.hostname clamav
54+
pass "Installed and configured ClamAV."
4955

5056
task "Installing Solr search modules."
5157
drush pm:install search_api search_api_solr
58+
pass "Installed Solr search modules."
5259

5360
# Enable custom site module and run its deployment hooks.
5461
#
@@ -60,9 +67,11 @@ if echo "${environment}" | grep -q -e dev -e stage -e ci -e local; then
6067
drush pm:install sw_search
6168

6269
drush pm:install sw_demo
70+
pass "Installed custom site modules."
6371

6472
task "Running deployment hooks."
6573
drush deploy:hook
74+
pass "Ran deployment hooks."
6675

6776
# Conditionally perform an action if this is a "fresh" database.
6877
if [ "${VORTEX_PROVISION_OVERRIDE_DB:-0}" = "1" ]; then

.vortex/installer/tests/Fixtures/handler_process/custom_modules_no_base/scripts/custom/provision-10-example.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@@ -55,7 +55,6 @@
1+
@@ -62,7 +62,6 @@
22
# Note that deployment hooks for already enabled modules have run in the
33
# parent "provision.sh" script.
44
task "Installing custom site modules."
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
@@ -59,8 +59,6 @@
1+
@@ -66,7 +66,6 @@
22

33
drush pm:install sw_search
44

55
- drush pm:install sw_demo
6-
-
7-
task "Running deployment hooks."
8-
drush deploy:hook
6+
pass "Installed custom site modules."
97

8+
task "Running deployment hooks."
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
@@ -57,8 +57,6 @@
1+
@@ -64,8 +64,6 @@
22
task "Installing custom site modules."
33
drush pm:install sw_base
44

55
- drush pm:install sw_search
66
-
77
drush pm:install sw_demo
8+
pass "Installed custom site modules."
89

9-
task "Running deployment hooks."
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
@@ -55,11 +55,6 @@
1+
@@ -62,11 +62,7 @@
22
# Note that deployment hooks for already enabled modules have run in the
33
# parent "provision.sh" script.
44
task "Installing custom site modules."
55
- drush pm:install sw_base
6-
-
6+
77
- drush pm:install sw_search
88
-
99
- drush pm:install sw_demo
10+
pass "Installed custom site modules."
1011

1112
task "Running deployment hooks."
12-
drush deploy:hook
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
@@ -47,9 +47,6 @@
2-
drush pm:install clamav
1+
@@ -53,10 +53,6 @@
32
drush config-set clamav.settings mode_daemon_tcpip.hostname clamav
3+
pass "Installed and configured ClamAV."
44

55
- task "Installing Solr search modules."
66
- drush pm:install search_api search_api_solr
7+
- pass "Installed Solr search modules."
78
-
89
# Enable custom site module and run its deployment hooks.
910
#
1011
# Note that deployment hooks for already enabled modules have run in the
11-
@@ -56,8 +53,6 @@
12+
@@ -63,8 +59,6 @@
1213
# parent "provision.sh" script.
1314
task "Installing custom site modules."
1415
drush pm:install sw_base
1516
-
1617
- drush pm:install sw_search
1718

1819
drush pm:install sw_demo
19-
20+
pass "Installed custom site modules."

.vortex/installer/tests/Fixtures/handler_process/migration_download_source_acquia/scripts/custom/provision-20-migration.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ VORTEX_DOWNLOAD_DB2_FILE="${VORTEX_DOWNLOAD_DB2_FILE:-db2.sql}"
4040
# ------------------------------------------------------------------------------
4141

4242
# @formatter:off
43+
info() { printf " ==> %s\n" "${1}"; }
4344
note() { printf " %s\n" "${1}"; }
44-
task() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[34m[TASK] %s\033[0m\n" "${1}" || printf "[TASK] %s\n" "${1}"; }
45-
info() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[36m[INFO] %s\033[0m\n" "${1}" || printf "[INFO] %s\n" "${1}"; }
46-
pass() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[32m[ OK ] %s\033[0m\n" "${1}" || printf "[ OK ] %s\n" "${1}"; }
47-
fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\033[31m[FAIL] %s\033[0m\n" "${1}" || printf "[FAIL] %s\n" "${1}"; }
45+
task() { printf " > %s\n" "${1}"; }
46+
pass() { printf " < %s\n" "${1}"; }
47+
fail() { printf " ! %s\n" "${1}"; }
4848
# @formatter:on
4949

5050
drush() { ./vendor/bin/drush -y "$@"; }
@@ -104,13 +104,17 @@ run_migration() {
104104
drush migrate:messages "${migration_name}"
105105
exit 1
106106
}
107+
108+
pass "Migrated: ${migration_name}."
107109
}
108110

109111
# Detect if existing migration source database is corrupted.
110112
if [ "${DRUPAL_MIGRATION_SOURCE_DB_IMPORT}" != "1" ]; then
111113
note "Source database import is set to be skipped. Checking existing database."
112114
task "Probing for '${DRUPAL_MIGRATION_SOURCE_DB_PROBE_TABLE}' table in the source database."
113-
if ! drush sql:query --database=migrate "SELECT COUNT(*) FROM ${DRUPAL_MIGRATION_SOURCE_DB_PROBE_TABLE}" >/dev/null 2>&1; then
115+
if drush sql:query --database=migrate "SELECT COUNT(*) FROM ${DRUPAL_MIGRATION_SOURCE_DB_PROBE_TABLE}" >/dev/null 2>&1; then
116+
pass "Source database is intact."
117+
else
114118
note "Migration source database is corrupted or empty. Re-importing."
115119
DRUPAL_MIGRATION_SOURCE_DB_IMPORT=1
116120
fi
@@ -137,18 +141,21 @@ if ! drush sql:query --database=migrate "SELECT COUNT(*) FROM ${DRUPAL_MIGRATION
137141
drush sql:query --database=migrate "SHOW TABLES;"
138142
exit 1
139143
fi
144+
pass "Verified migration source database."
140145

141146
# Enable custom migration modules.
142147
task "Enabling migration modules."
143148
drush pm:install ys_migrate
149+
pass "Enabled migration modules."
144150

145-
task "Starting migrations."
151+
info "Starting migrations."
146152

147153
if [ "${DRUPAL_MIGRATION_ROLLBACK_SKIP}" = "1" ]; then
148154
note "Skipping rollback of all migrations."
149155
else
150156
task "Rolling back all migrations."
151157
drush migrate:rollback --all || true
158+
pass "Rolled back all migrations."
152159
fi
153160
echo
154161

0 commit comments

Comments
 (0)