#!/usr/bin/env bash### Action description that the script performs.## More description and usage information with a last empty# comment line.#set-eu
["${DREVOPS_DEBUG-}"="1"]&&set-x
MUST list all variables with their default values and descriptions. i.e.:
pass"Finished GitHub notification for operation ${DREVOPS_NOTIFY_EVENT}"
MUST use uppercase global variables
MUST use lowercase local variables.
MUST use long options instead of short options for readability. I.e., drush cache:rebuild instead of drush cr.
MUST use DREVOPS_ prefix for variables, unless it is a known 3-rd party
variable like GITHUB_TOKEN or COMPOSER.
MUST use script-specific prefix. I.e., for notify.sh, the variable to skip
notifications should start with DREVOPS_NOTIFY_.
MAY rely on variables from the external scripts (not prefixed with a
script-specific prefix), but MUST declare such variables in the header of
the file.
MAY call other DrevOps scripts (discouraged), but MUST source them rather
than creating a sub-process. This is to allow passing environment variables
down the call stack.
SHOULD use note messages for informing about the script progress.
#!/usr/bin/env bash### Action description that the script performs.## More description and usage information with a last empty# comment line.#set-eu
["${DREVOPS_DEBUG-}"="1"]&&set-x
# Example scaffold variable with a default value.DREVOPS_SCAFFOLD_EXAMPLE_URL="${DREVOPS_SCAFFOLD_EXAMPLE_URL:-http://example.com}"# ------------------------------------------------------------------------------# @formatter:offnote(){printf" %s\n""$1";}info(){["${TERM:-}"!="dumb"]&&tputcolors>/dev/null2>&1&&printf"\033[34m[INFO] %s\033[0m\n""$1"||printf"[INFO] %s\n""$1";}pass(){["${TERM:-}"!="dumb"]&&tputcolors>/dev/null2>&1&&printf"\033[32m[ OK ] %s\033[0m\n""$1"||printf"[ OK ] %s\n""$1";}fail(){["${TERM:-}"!="dumb"]&&tputcolors>/dev/null2>&1&&printf"\033[31m[FAIL] %s\033[0m\n""$1"||printf"[FAIL] %s\n""$1";}# @formatter:oninfo"Started scaffold operations."[-z"${DREVOPS_SCAFFOLD_EXAMPLE_URL}"]&&fail"Missing required value for DREVOPS_SCAFFOLD_EXAMPLE_URL"&&exit1command-vcurl>/dev/null||(fail"curl command is not available."&&exit1)# Example of the script body.curl-L-s-o/dev/null-w"%{http_code}""${DREVOPS_SCAFFOLD_EXAMPLE_URL}"|grep-q'200\|403'&¬e"Requested example page"pass"Finished scaffold operations."