-
Notifications
You must be signed in to change notification settings - Fork 23
/
.envrc
34 lines (29 loc) · 967 Bytes
/
.envrc
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
[ -f "$HOME/.envrc" ] && source_env $HOME || true
[ -f "../.envrc" ] && source_env ../ || true
export_function() {
local name=$1
local alias_dir=$PWD/.direnv/aliases
mkdir -p "$alias_dir"
PATH_add "$alias_dir"
local target="$alias_dir/$name"
if declare -f "$name" >/dev/null; then
echo "#!/usr/bin/env bash" > "$target"
declare -f "$name" >> "$target" 2>/dev/null
echo "$name" >> "$target"
chmod +x "$target"
fi
}
export ROOT_PROJECT="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
export PROJECT_NAME=oar-docker
mkvenv() {
VENV_PATH="$HOME/.virtualenvs/$PROJECT_NAME"
virtualenv $VENV_PATH
PATH="$HOME/.virtualenvs/$PROJECT_NAME/bin/:$PATH" make init
direnv reload
}
export_function mkvenv
if [ -e "$ROOT_PROJECT/venv/bin/activate" ]; then
source "$ROOT_PROJECT/venv/bin/activate"
elif [ -e "$HOME/.virtualenvs/$PROJECT_NAME/bin/activate" ]; then
source "$HOME/.virtualenvs/$PROJECT_NAME/bin/activate"
fi