-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.framework-config
executable file
·50 lines (44 loc) · 2.82 KB
/
.framework-config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
# shellcheck disable=SC2034
FRAMEWORK_ROOT_DIR="$(cd -- "${CURRENT_LOADED_ENV_FILE%/*}" &>/dev/null && pwd -P)"
FRAMEWORK_SRC_DIR="${FRAMEWORK_SRC_DIR:-${FRAMEWORK_ROOT_DIR}/src}"
FRAMEWORK_BIN_DIR="${FRAMEWORK_BIN_DIR:-${FRAMEWORK_ROOT_DIR}/bin}"
FRAMEWORK_VENDOR_DIR="${FRAMEWORK_VENDOR_DIR:-${FRAMEWORK_ROOT_DIR}/vendor}"
FRAMEWORK_VENDOR_BIN_DIR="${FRAMEWORK_VENDOR_BIN_DIR:-${FRAMEWORK_ROOT_DIR}/vendor/bin}"
if [[ ! -v COMPILE_PARAMETERS ]]; then
# compile parameters
# srcFile : file that needs to be compiled
# templateDir : directory from which templates will be searched
# binDir : fallback bin directory in case BIN_FILE has not been provided
# rootDir : directory used to compute src file relative path
# srcDirs : additional directories where to find the functions
COMPILE_PARAMETERS=(
--src-dir "${FRAMEWORK_SRC_DIR}"
--bin-dir "${FRAMEWORK_BIN_DIR}"
--root-dir "${FRAMEWORK_ROOT_DIR}"
--template-dir "${FRAMEWORK_SRC_DIR}"
)
fi
# describe the functions that will be skipped from being imported
FRAMEWORK_FUNCTIONS_IGNORE_REGEXP="${FRAMEWORK_FUNCTIONS_IGNORE_REGEXP:-^(Namespace::functions|Functions::myFunction|Namespace::requireSomething|IMPORT::dir::file|Acquire::ForceIPv4)$}"
# describe the files that do not contain function to be imported
NON_FRAMEWORK_FILES_REGEXP="${NON_FRAMEWORK_FILES_REGEXP:-(^bin/|^hooks/|^test.sh$|^preCommitTest.sh$|^.github/|^.docker/createUser.|.framework-config|.bats$|/testsData/|^manualTests/|/_.sh$|/ZZZ.sh$|/__all.sh$|^src/_binaries|^src/_includes|^src/batsHeaders.sh$|^src/_standalone)}"
# describe the files that are allowed to not have an associated bats file
BATS_FILE_NOT_NEEDED_REGEXP="${BATS_FILE_NOT_NEEDED_REGEXP:-(^bin/|.framework-config|^.docker/|^.github/|.bats$|/testsData/|^manualTests/|/_.sh$|/ZZZ.sh$|/__all.sh$|^src/batsHeaders.sh$|^src/_includes)}"
# describe the files that are allowed to not have a function matching the filename
FRAMEWORK_FILES_FUNCTION_MATCHING_IGNORE_REGEXP="${FRAMEWORK_FILES_FUNCTION_MATCHING_IGNORE_REGEXP:-^bin/|^.github/|^\.framework-config$|/testsData/|^manualTests/|\.bats$|src/Options/_bats.sh}"
# Source directories
if [[ ! -v FRAMEWORK_SRC_DIRS ]]; then
FRAMEWORK_SRC_DIRS=(
"${FRAMEWORK_ROOT_DIR}/src"
)
fi
# export here all the variables that will be used in your templates
export REPOSITORY_URL="${REPOSITORY_URL:-https://github.com/fchastanet/bash-tools-framework}"
BASH_FRAMEWORK_THEME="${BASH_FRAMEWORK_THEME:-default}"
BASH_FRAMEWORK_LOG_LEVEL="${BASH_FRAMEWORK_LOG_LEVEL:-0}"
BASH_FRAMEWORK_DISPLAY_LEVEL="${BASH_FRAMEWORK_DISPLAY_LEVEL:-3}"
BASH_FRAMEWORK_LOG_FILE="${BASH_FRAMEWORK_LOG_FILE:-${FRAMEWORK_ROOT_DIR}/logs/${0##*/}.log}"
BASH_FRAMEWORK_LOG_FILE_MAX_ROTATION="${BASH_FRAMEWORK_LOG_FILE_MAX_ROTATION:-5}"
# display elapsed time since last log
DISPLAY_DURATION=${DISPLAY_DURATION:-1}