generated from norlab-ulaval/template-norlab-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.env.project
33 lines (31 loc) · 1.39 KB
/
.env.project
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
# =================================================================================================
#
# Set project related environment variables. Those are available both for convenience
# and for N2ST own usage.
#
# 1. ToDo: Copy this script at the root of your superproject
# 2. (optional) ToDo: set PROJECT_PROMPT_NAME="<set-a-custom-name-for-consol-print>"
# 3. source it
#
# Usage from within a shell script:
#
# Important! Source this file from your superproject repository root
# $ cd <my/superproject/root>
# $ set -o allexport
# $ source ./utilities/norlab-shell-script-tools/.env.project
# $ set +o allexport
#
# Check the exported environment variables:
# $ printenv | grep -i -e PROJECT_GIT_REMOTE_URL -e PROJECT_GIT_NAME -e PROJECT_PATH -e PROJECT_SRC_NAME
#
# Optional:
# Set PROJECT_PROMPT_NAME explicitly if you want n2st::print_msg functions to use a custom name,
# otherwise N2ST will use PROJECT_GIT_NAME by default
#
# =================================================================================================
#PROJECT_PROMPT_NAME="<MyCoolProjectPrompt>"
# ....Programaticaly fetch source code information.................................................
PROJECT_GIT_REMOTE_URL=$( git remote get-url origin )
PROJECT_GIT_NAME=$( basename "${PROJECT_GIT_REMOTE_URL}" .git )
PROJECT_PATH=$( git rev-parse --show-toplevel )
PROJECT_SRC_NAME="$( basename ${PROJECT_PATH} )"