client: optimize/refactor repository path

- Reduces all calls into a single line
- Redefines path as root repository path
This commit is contained in:
2024-07-17 22:39:48 -07:00
parent cd9681566b
commit 7118a39f6d
7 changed files with 34 additions and 17 deletions

View File

@@ -21,7 +21,12 @@
# Implementation
#
source "$(dirname "$(realpath -s $0)")/src/docker/lib/lib_docker.bash" || exit 1
if [ -z "$DOCKER_FINANCE_CLIENT_REPO" ]; then
declare -gx DOCKER_FINANCE_CLIENT_REPO
DOCKER_FINANCE_CLIENT_REPO="$(dirname "$(realpath -s $0)" | rev | cut -d'/' -f2- | rev)"
fi
source "${DOCKER_FINANCE_CLIENT_REPO}/client/src/docker/lib/lib_docker.bash" || exit 1
#
# Execute

View File

@@ -17,12 +17,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
[ -z "$DOCKER_FINANCE_CLIENT_REPO" ] && exit 1
#
# "Libraries"
#
source "$(dirname "$(realpath -s $0)")/src/docker/lib/internal/lib_docker.bash" || exit 1
source "$(dirname "$(realpath -s $0)")/../container/src/finance/lib/internal/lib_utils.bash" || exit 1
source "${DOCKER_FINANCE_CLIENT_REPO}/client/src/docker/lib/internal/lib_docker.bash" || exit 1
source "${DOCKER_FINANCE_CLIENT_REPO}/container/src/finance/lib/internal/lib_utils.bash" || exit 1
#
# Implementation

View File

@@ -17,11 +17,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
[ -z "$DOCKER_FINANCE_CLIENT_REPO" ] && exit 1
#
# "Libraries"
#
source "$(dirname "$(realpath -s $0)")/../container/src/finance/lib/internal/lib_utils.bash" || exit 1
source "${DOCKER_FINANCE_CLIENT_REPO}/container/src/finance/lib/internal/lib_utils.bash" || exit 1
#
# Implementation

View File

@@ -17,12 +17,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
[ -z "$DOCKER_FINANCE_CLIENT_REPO" ] && exit 1
#
# "Libraries"
#
source "$(dirname "$(realpath -s $0)")/src/docker/lib/internal/lib_docker.bash" || exit 1
source "$(dirname "$(realpath -s $0)")/../container/src/finance/lib/internal/lib_utils.bash" || exit 1
source "${DOCKER_FINANCE_CLIENT_REPO}/client/src/docker/lib/internal/lib_docker.bash" || exit 1
source "${DOCKER_FINANCE_CLIENT_REPO}/container/src/finance/lib/internal/lib_utils.bash" || exit 1
#
# Implementation

View File

@@ -17,12 +17,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
[ -z "$DOCKER_FINANCE_CLIENT_REPO" ] && exit 1
#
# "Libraries"
#
# Utilities (a container library (but container is never exposed to client code))
source "$(dirname "$(realpath -s $0)")/../container/src/finance/lib/internal/lib_utils.bash" || exit 1
source "${DOCKER_FINANCE_CLIENT_REPO}/container/src/finance/lib/internal/lib_utils.bash" || exit 1
#
# Implementation

View File

@@ -17,11 +17,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
[ -z "$DOCKER_FINANCE_CLIENT_REPO" ] && exit 1
#
# "Libraries"
#
source "$(dirname "$(realpath -s $0)")/../container/src/finance/lib/internal/lib_utils.bash" || exit 1
source "${DOCKER_FINANCE_CLIENT_REPO}/container/src/finance/lib/internal/lib_utils.bash" || exit 1
#
# Implementation
@@ -62,7 +64,7 @@ function lib_gen::gen()
lib_utils::print_debug "Constructing environment"
# Generate `docker-finance` version
global_repo_manifest="$(dirname "$(realpath -s $0)")/docker-finance.yaml"
global_repo_manifest="${DOCKER_FINANCE_CLIENT_REPO}/client/docker-finance.yaml"
declare -gr global_repo_manifest
global_client_version="$(grep '^version: ' $global_repo_manifest | sed -e 's/version: "//' -e 's/"//g')"
@@ -70,7 +72,7 @@ function lib_gen::gen()
declare -gr global_client_version
# Repository-provided (not user-defined) default environment
global_repo_conf_dir="$(dirname "$(realpath -s $0)")/docker-finance.d"
global_repo_conf_dir="${DOCKER_FINANCE_CLIENT_REPO}/client/docker-finance.d"
declare -gr global_repo_conf_dir
# Environment
@@ -98,7 +100,7 @@ function lib_gen::gen()
declare -gr global_platform_image
# Base location of Docker-related files (.in and final out files)
global_repo_dockerfiles="$(dirname "$(realpath -s $0)")/Dockerfiles/${global_platform_image}"
global_repo_dockerfiles="${DOCKER_FINANCE_CLIENT_REPO}/client/Dockerfiles/${global_platform_image}"
# shellcheck disable=SC2034 # used in lib_docker
declare -gr global_repo_dockerfiles

View File

@@ -17,23 +17,25 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
[ -z "$DOCKER_FINANCE_CLIENT_REPO" ] && exit 1
#
# "Libraries"
#
# Docker impl
source "$(dirname "$(realpath -s $0)")/src/docker/lib/internal/lib_docker.bash" || exit 1
source "${DOCKER_FINANCE_CLIENT_REPO}/client/src/docker/lib/internal/lib_docker.bash" || exit 1
# Environment generation
source "$(dirname "$(realpath -s $0)")/src/docker/lib/internal/lib_gen.bash" || exit 1
source "${DOCKER_FINANCE_CLIENT_REPO}/client/src/docker/lib/internal/lib_gen.bash" || exit 1
# Development tools
source "$(dirname "$(realpath -s $0)")/src/docker/lib/internal/dev-tools/lib_doxygen.bash" || exit 1
source "$(dirname "$(realpath -s $0)")/src/docker/lib/internal/dev-tools/lib_license.bash" || exit 1
source "$(dirname "$(realpath -s $0)")/src/docker/lib/internal/dev-tools/lib_linter.bash" || exit 1
source "${DOCKER_FINANCE_CLIENT_REPO}/client/src/docker/lib/internal/dev-tools/lib_doxygen.bash" || exit 1
source "${DOCKER_FINANCE_CLIENT_REPO}/client/src/docker/lib/internal/dev-tools/lib_license.bash" || exit 1
source "${DOCKER_FINANCE_CLIENT_REPO}/client/src/docker/lib/internal/dev-tools/lib_linter.bash" || exit 1
# Utilities (a container library (but container is never exposed to client code))
source "$(dirname "$(realpath -s $0)")/../container/src/finance/lib/internal/lib_utils.bash" || exit 1
source "${DOCKER_FINANCE_CLIENT_REPO}/container/src/finance/lib/internal/lib_utils.bash" || exit 1
#
# Implementation