Skip to content

Commit

Permalink
#493: export variables for commandlets (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
hohwille authored Dec 14, 2020
1 parent 80b7223 commit cc39861
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions scripts/src/main/resources/scripts/environment-project
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ if [ -n "${DEVON_IDE_TRACE}" ]; then set -vx; fi

# $1: path of properties file to load
# $2: optional prefix to add to variables
# $3: optional arg to export all variables if not empty
function doLoadProperties() {
if ! [ -f "${1}" ]
then
Expand Down Expand Up @@ -33,6 +34,9 @@ function doLoadProperties() {
then
export_key="true"
key="${key:7}"
elif [ -n "${3}" ]
then
export_key="true"
fi
key="${2}${key/./_}"
if [ -z "${value}" ]
Expand Down Expand Up @@ -71,10 +75,10 @@ then
DEVON_HOME_DIR="$(cygpath "${USERPROFILE}")"
fi
# load and setup configuration
doLoadProperties "${DEVON_IDE_HOME}/scripts/devon.properties"
doLoadProperties "${DEVON_HOME_DIR}/devon.properties"
doLoadProperties "${DEVON_IDE_HOME}/devon.properties"
doLoadProperties "${SETTINGS_PATH}/devon.properties"
doLoadProperties "${DEVON_IDE_HOME}/scripts/devon.properties" "" "${@}"
doLoadProperties "${DEVON_HOME_DIR}/devon.properties" "" "${@}"
doLoadProperties "${DEVON_IDE_HOME}/devon.properties" "" "${@}"
doLoadProperties "${SETTINGS_PATH}/devon.properties" "" "${@}"
if [ -z "${WORKSPACE}" ]
then
WORKSPACE=main
Expand All @@ -91,7 +95,7 @@ then
echo "WARNING: Worksapce ${WORKSPACE} does not exist"
fi
fi
doLoadProperties "${WORKSPACE_PATH}/devon.properties"
doLoadProperties "${WORKSPACE_PATH}/devon.properties" "" "${@}"

if [ -z "${DEVON_OLD_PATH}" ]
then
Expand Down Expand Up @@ -146,6 +150,6 @@ then
fi

# load user settings late so variables like M2_REPO can be overridden
doLoadProperties "${DEVON_IDE_HOME}/conf/devon.properties"
doLoadProperties "${DEVON_IDE_HOME}/conf/devon.properties" "" "${@}"

export PATH
2 changes: 1 addition & 1 deletion scripts/src/main/resources/scripts/functions
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ then
fi

# shellcheck source=scripts/environment-project
source "${DEVON_IDE_HOME}/scripts/environment-project"
source "${DEVON_IDE_HOME}/scripts/environment-project" export
DEVON_DOWNLOAD_DIR="${DEVON_HOME_DIR}/Downloads"

# $1: message (may contain newlines with \n)
Expand Down

0 comments on commit cc39861

Please sign in to comment.