-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathactivate
More file actions
56 lines (48 loc) · 1.55 KB
/
activate
File metadata and controls
56 lines (48 loc) · 1.55 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# This file must be used with "source bin/activate" *from bash* - you cannot run it directly
deactivate () {
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
hash -r
fi
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
PS1="${_OLD_VIRTUAL_PS1:-}"
export PS1
unset _OLD_VIRTUAL_PS1
fi
unset APP_ENV
type apprun &>/dev/null && unset -f apprun
type dbrun &>/dev/null && unset -f dbrun
if [ ! "${1:-}" = "nondestructive" ] ; then
# Self destruct!
unset -f deactivate
fi
}
# unset irrelevant variables
deactivate nondestructive
apprun () {
docker-compose exec app /bin/bash -c "$1"
}
dbrun () {
docker-compose exec db /bin/bash -c "$1"
}
if [ -z "${APP_ENV_DISABLE_PROMPT:-}" ] ; then
_OLD_VIRTUAL_PS1="${PS1:-}"
if [ "x(docker-env) " != x ] ; then
PS1="(docker-env) ${PS1:-}"
else
if [ "`basename \"$APP_ENV\"`" = "__" ] ; then
PS1="[`basename \`dirname \"$APP_ENV\"\``] $PS1"
else
PS1="(`basename \"$APP_ENV\"`)$PS1"
fi
fi
export PS1
fi
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
hash -r
fi