From 2bbb30036ee723c1ebede1ca108d717c6cd9031d Mon Sep 17 00:00:00 2001 From: Marco Vermeulen Date: Sat, 4 May 2013 23:42:39 +0100 Subject: [PATCH] Source modules on every initialisation. --- src/main/bash/gvm-init.sh | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/main/bash/gvm-init.sh b/src/main/bash/gvm-init.sh index 5000010e..9f7b3a28 100755 --- a/src/main/bash/gvm-init.sh +++ b/src/main/bash/gvm-init.sh @@ -19,7 +19,25 @@ export GVM_VERSION="@GVM_VERSION@" export GVM_PLATFORM=$(uname) +function gvm_source_modules { + # Source gvm module scripts. + for f in $(find "${GVM_DIR}/src" -type f -name 'gvm-*'); do + source "${f}" + done + + # Source extension files prefixed with 'gvm-' and found in the ext/ folder + # Use this if extensions are written with the functional approach and want + # to use functions in the main gvm script. + for f in $(find "${GVM_DIR}/ext" -type f -name 'gvm-*'); do + if [ -r "${f}" ]; then + source "${f}" + fi + done + unset f +} + if [[ "${GVM_INIT}" == "true" ]]; then + gvm_source_modules return fi @@ -111,19 +129,5 @@ VERTX_HOME="${GVM_DIR}/vertx/current" export PATH="${GROOVY_HOME}/bin:${GRAILS_HOME}/bin:${GRIFFON_HOME}/bin:${GRADLE_HOME}/bin:${LAZYBONES_HOME}/bin:${VERTX_HOME}/bin:$PATH" -# Source gvm module scripts. -for f in $(find "${GVM_DIR}/src" -type f -name 'gvm-*'); do - source "${f}" -done - -# Source extension files prefixed with 'gvm-' and found in the ext/ folder -# Use this if extensions are written with the functional approach and want -# to use functions in the main gvm script. -for f in $(find "${GVM_DIR}/ext" -type f -name 'gvm-*'); do - if [ -r "${f}" ]; then - source "${f}" - fi -done -unset f - +gvm_source_modules export GVM_INIT="true"