diff --git a/bootstrap.sh b/bootstrap.sh index c271536..0efb228 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,7 +1,7 @@ # shellcheck shell=bash # The following is eval'ed as 'eval "$GLUE_BOOTSTRAP"' -# in either '{commands,actions}/{,auto/}*' +# in either '{tasks,actions}/{,auto/}*' # Check if we have already bootstraped. This is useful for multiple sources of files if [ ! "$GLUE_BOOTSTRAP_DID" = yes ]; then @@ -14,10 +14,10 @@ if [ ! "$GLUE_BOOTSTRAP_DID" = yes ]; then exit 1 fi - if [ -f "$GLUE_WD/.glue/common/bootstrap.sh" ]; then - source "$GLUE_WD/.glue/common/bootstrap.sh" - elif [ -f "$GLUE_WD/.glue/common/auto/bootstrap.sh" ]; then - source "$GLUE_WD/.glue/common/auto/bootstrap.sh" + if [ -f "$GLUE_WD/.glue/util/bootstrap.sh" ]; then + source "$GLUE_WD/.glue/util/bootstrap.sh" + elif [ -f "$GLUE_WD/.glue/util/auto/bootstrap.sh" ]; then + source "$GLUE_WD/.glue/util/auto/bootstrap.sh" else echo "Context \$0: '$0'" >&2 echo "Context \${BASH_SOURCE[*]}: ${BASH_SOURCE[*]}" >&2 diff --git a/common/command.sh b/common/command.sh deleted file mode 100644 index d89773d..0000000 --- a/common/command.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -# @description Log the currently running command -# @noargs -# @see action.log -command.log() { - # Path to the currently actually executing 'action' script - # This works on the assumption that 'source's are all absolute paths - local currentCommand="${BASH_SOURCE[2]}" - local currentCommandDirname="${currentCommand%/*}" - - if [ "${currentCommandDirname##*/}" = auto ]; then - if [[ "${LANG,,?}" == *utf?(-)8 ]]; then - echo "■■ 🢂 START COMMAND: 'auto/${currentCommand##*/}'" - else - echo ":: => START COMMAND: 'auto/${currentCommand##*/}'" - fi - else - if [[ "${LANG,,?}" == *utf?(-)8 ]]; then - echo "■■ 🢂 START COMMAND: '${currentCommand##*/}'" - else - echo ":: => START COMMAND: '${currentCommand##*/}'" - fi - fi -} diff --git a/docs/task-steps.md b/docs/task-steps.md index 986e728..c867a6a 100644 --- a/docs/task-steps.md +++ b/docs/task-steps.md @@ -1,6 +1,6 @@ # General Steps for Tasks -Common task identifiers like 'build', 'docs', 'lint' are common across languages. This document lists them with some explanations. Depending on the project type, some commands may accept flags. For example, use `glue cmd docs -- --help` to show the help, if applicable +Common task identifiers like 'build', 'docs', 'lint' are common across languages. This document lists them with some explanations. Depending on the project type, some tasks may accept flags. For example, use `glue cmd docs -- --help` to show the help, if applicable ## docs diff --git a/commands/Bash.build.sh b/tasks/Bash.build.sh similarity index 91% rename from commands/Bash.build.sh rename to tasks/Bash.build.sh index 1daf039..fe1dfac 100755 --- a/commands/Bash.build.sh +++ b/tasks/Bash.build.sh @@ -20,7 +20,7 @@ task() { source "$REPLY" # With 'set -e' enabled, the previous commands - # were successfull; otherwise, we wouldn't be here + # were successful; otherwise, we wouldn't be here REPLY=0 } diff --git a/commands/Bash.docs.sh b/tasks/Bash.docs.sh similarity index 100% rename from commands/Bash.docs.sh rename to tasks/Bash.docs.sh diff --git a/commands/Bash.lint.sh b/tasks/Bash.lint.sh similarity index 100% rename from commands/Bash.lint.sh rename to tasks/Bash.lint.sh diff --git a/commands/Bash.release.sh b/tasks/Bash.release.sh similarity index 92% rename from commands/Bash.release.sh rename to tasks/Bash.release.sh index c481bb1..e371cf9 100755 --- a/commands/Bash.release.sh +++ b/tasks/Bash.release.sh @@ -25,22 +25,22 @@ task() { ## 2 # Build docs - util.get_command 'Bash.docs.sh' + util.get_task 'Bash.docs.sh' source "$REPLY" ensure.exit_code_success "$REPLY" # Lint - util.get_command 'Bash.lint.sh' + util.get_task 'Bash.lint.sh' source "$REPLY" ensure.exit_code_success "$REPLY" # Build - util.get_command 'Bash.build.sh' + util.get_task 'Bash.build.sh' source "$REPLY" ensure.exit_code_success "$REPLY" # Test - util.get_command 'Bash.test.sh' + util.get_task 'Bash.test.sh' source "$REPLY" ensure.exit_code_success "$REPLY" diff --git a/commands/Bash.run.sh b/tasks/Bash.run.sh similarity index 94% rename from commands/Bash.run.sh rename to tasks/Bash.run.sh index 3e5f467..8f28e8c 100755 --- a/commands/Bash.run.sh +++ b/tasks/Bash.run.sh @@ -8,7 +8,7 @@ task() { ensure.nonZero 'cmdName' "$cmdName" shift - util.get_command 'Bash.build.sh' + util.get_task 'Bash.build.sh' source "$REPLY" local -a args=() diff --git a/commands/Bash.test.sh b/tasks/Bash.test.sh similarity index 100% rename from commands/Bash.test.sh rename to tasks/Bash.test.sh diff --git a/commands/Cpp.lint.sh b/tasks/Cpp.lint.sh similarity index 100% rename from commands/Cpp.lint.sh rename to tasks/Cpp.lint.sh diff --git a/commands/Go_Binary.build.sh b/tasks/Go_Binary.build.sh similarity index 100% rename from commands/Go_Binary.build.sh rename to tasks/Go_Binary.build.sh diff --git a/commands/Go_Binary.release.sh b/tasks/Go_Binary.release.sh similarity index 100% rename from commands/Go_Binary.release.sh rename to tasks/Go_Binary.release.sh diff --git a/commands/Go_Library.build.sh b/tasks/Go_Library.build.sh similarity index 100% rename from commands/Go_Library.build.sh rename to tasks/Go_Library.build.sh diff --git a/commands/Nim_Binary.build.sh b/tasks/Nim_Binary.build.sh similarity index 100% rename from commands/Nim_Binary.build.sh rename to tasks/Nim_Binary.build.sh diff --git a/commands/Nim_Binary.release.sh b/tasks/Nim_Binary.release.sh similarity index 100% rename from commands/Nim_Binary.release.sh rename to tasks/Nim_Binary.release.sh diff --git a/commands/NodeJS_Server.ci.sh b/tasks/NodeJS_Server.ci.sh similarity index 100% rename from commands/NodeJS_Server.ci.sh rename to tasks/NodeJS_Server.ci.sh diff --git a/commands/NodeJS_Server.deploy.sh b/tasks/NodeJS_Server.deploy.sh similarity index 100% rename from commands/NodeJS_Server.deploy.sh rename to tasks/NodeJS_Server.deploy.sh diff --git a/commands/NodeJS_Server.format.sh b/tasks/NodeJS_Server.format.sh similarity index 100% rename from commands/NodeJS_Server.format.sh rename to tasks/NodeJS_Server.format.sh diff --git a/commands/NodeJS_Server.lint.sh b/tasks/NodeJS_Server.lint.sh similarity index 100% rename from commands/NodeJS_Server.lint.sh rename to tasks/NodeJS_Server.lint.sh diff --git a/commands/NodeJS_Server.release.sh b/tasks/NodeJS_Server.release.sh similarity index 100% rename from commands/NodeJS_Server.release.sh rename to tasks/NodeJS_Server.release.sh diff --git a/commands/Python.build.sh b/tasks/Python.build.sh similarity index 100% rename from commands/Python.build.sh rename to tasks/Python.build.sh diff --git a/common/action.sh b/util/action.sh similarity index 92% rename from common/action.sh rename to util/action.sh index e8c5d5f..a32c921 100644 --- a/common/action.sh +++ b/util/action.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash -# @description Print the currently running command +# @description Print the currently running action # @noargs -# @see command.log +# @see task.log action.log() { # ${BASH_SOURCE[0]}: Ex. ~/.../.glue/actions/auto/util/action.sh # ${BASH_SOURCE[1]}: Ex. ~/.../.glue/actions/auto/util/bootstrap.sh diff --git a/common/bootstrap.sh b/util/bootstrap.sh similarity index 94% rename from common/bootstrap.sh rename to util/bootstrap.sh index 9737601..99760c5 100644 --- a/common/bootstrap.sh +++ b/util/bootstrap.sh @@ -20,8 +20,8 @@ bootstrap() { cd "$_original_wd" } - # source files in 'common' - local dir="common" + # source files in 'util' + local dir="util" shopt -q nullglob local shoptExitStatus="$?" @@ -84,8 +84,8 @@ bootstrap() { actions) action.log ;; - commands) - command.log + tasks) + task.log ;; *) die "boostrap: Directory '$dir' not supported" @@ -121,11 +121,11 @@ unbootstrap() { # Print case "$dir" in - commands) + tasks) if [[ "${LANG,,?}" == *utf?(-)8 ]]; then - echo "■■ 🢀 END COMMAND" + echo "■■ 🢀 END TASK" else - echo ":: <= END COMMAND" + echo ":: <= END TASK" fi ;; diff --git a/common/ensure.sh b/util/ensure.sh similarity index 100% rename from common/ensure.sh rename to util/ensure.sh diff --git a/common/error.sh b/util/error.sh similarity index 100% rename from common/error.sh rename to util/error.sh diff --git a/common/generated.sh b/util/generated.sh similarity index 100% rename from common/generated.sh rename to util/generated.sh diff --git a/common/is.sh b/util/is.sh similarity index 100% rename from common/is.sh rename to util/is.sh diff --git a/common/log.sh b/util/log.sh similarity index 100% rename from common/log.sh rename to util/log.sh diff --git a/common/semver.sh b/util/semver.sh similarity index 100% rename from common/semver.sh rename to util/semver.sh diff --git a/util/task.sh b/util/task.sh new file mode 100644 index 0000000..1a7e3d0 --- /dev/null +++ b/util/task.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# @description Log the currently running task +# @noargs +# @see action.log +task.log() { + # Path to the currently actually executing 'action' script + # This works on the assumption that 'source's are all absolute paths + local currentTask="${BASH_SOURCE[2]}" + local currentTaskDirname="${currentTask%/*}" + + if [ "${currentTaskDirname##*/}" = auto ]; then + if [[ "${LANG,,?}" == *utf?(-)8 ]]; then + echo "■■ 🢂 START TASK: 'auto/${currentTask##*/}'" + else + echo ":: => START TASK: 'auto/${currentTask##*/}'" + fi + else + if [[ "${LANG,,?}" == *utf?(-)8 ]]; then + echo "■■ 🢂 START TASK: '${currentTask##*/}'" + else + echo ":: => START TASK: '${currentTask##*/}'" + fi + fi +} diff --git a/common/toml.sh b/util/toml.sh similarity index 100% rename from common/toml.sh rename to util/toml.sh diff --git a/common/util.sh b/util/util.sh similarity index 96% rename from common/util.sh rename to util/util.sh index c798080..ce9ec96 100644 --- a/common/util.sh +++ b/util/util.sh @@ -49,15 +49,15 @@ util.get_action() { fi } -# Get any particular file in the 'commands' directory +# Get any particular file in the 'tasks' directory # Pass '-q' as the first arg to set the result to # '$REPLY' rather than outputing to standard output -util.get_command() { +util.get_task() { if [ "$1" = "-p" ]; then - util.get_file "commands" "$2" + util.get_file "tasks" "$2" printf "%s\n" "$REPLY" else - util.get_file "commands" "$1" + util.get_file "tasks" "$1" fi }