-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivate
More file actions
executable file
·122 lines (107 loc) · 3.2 KB
/
activate
File metadata and controls
executable file
·122 lines (107 loc) · 3.2 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
if [ -d phpenv ];then
cd phpenv
PHPENV=$(pwd)
cd -
else
PHPENV=$(pwd)
fi
#cd -
#Go to the phpenv folder
alias phpenv="cd ${PHPENV}"
#Go to the Project folder
alias pf="cd $(dirname -- $(realpath -- ${PHPENV}))"
#artisan command
alias artisan="${PHPENV}/artisan"
#db service
alias db="${PHPENV}/db"
#phpenv workspace
alias workspace="${PHPENV}/workspace"
#tinker
alias tinker="${PHPENV}/artisan tinker"
#info
alias info="cd ${PHPENV}&&./console info&&cd -"
function console {
cd ${PHPENV}
./console $@
cd -
}
# stop stack then restart running containers (same as: console stop && console restart)
# Note: to apply new SERVICES in phpenv/.env and create missing containers (e.g. redis), use: console stop && console start
function envrestart {
console stop && console restart
}
#start up as active
cd ${PHPENV}
#gen default link file
NUM=$(ls -1 envs|wc -l)
if [ $NUM -eq 0 ];then
./link default
fi
./start
cd -
#
# This file must be used with "source bin/activate" *from bash*
# you cannot run it directly
deactivate () {
# Full deactivate only: drop phpenv commands. Skip when called as
# `deactivate nondestructive` (used once while sourcing this file).
if [ "${1:-}" != "nondestructive" ]; then
for _phpenv_alias in phpenv pf artisan db workspace tinker info; do
unalias "${_phpenv_alias}" 2>/dev/null
done
unset -f console envrestart 2>/dev/null
unset PHPENV 2>/dev/null
fi
# reset old environment variables
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
PATH="${_OLD_VIRTUAL_PATH:-}"
export PATH
unset _OLD_VIRTUAL_PATH
fi
if [ -n "${_OLD_VIRTUAL_PHPENVHOME:-}" ] ; then
PHPENVHOME="${_OLD_VIRTUAL_PHPENVHOME:-}"
export PHPENVHOME
unset _OLD_VIRTUAL_PHPENVHOME
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 2> /dev/null
fi
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
PS1="${_OLD_VIRTUAL_PS1:-}"
export PS1
unset _OLD_VIRTUAL_PS1
fi
unset VIRTUAL_ENV
if [ ! "${1:-}" = "nondestructive" ] ; then
# Self destruct!
unset -f deactivate
fi
}
# unset irrelevant variables
deactivate nondestructive
VIRTUAL_ENV=$(dirname -- $(realpath -- ${PHPENV}))
export VIRTUAL_ENV
_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/bin:$PATH"
export PATH
# unset PHPENVHOME if set
# this will fail if PHPENVHOME is set to the empty string (which is bad anyway)
# could use `if (set -u; : $PHPENVHOME) ;` in bash
if [ -n "${PHPENVHOME:-}" ] ; then
_OLD_VIRTUAL_PHPENVHOME="${PHPENVHOME:-}"
unset PHPENVHOME
fi
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
_OLD_VIRTUAL_PS1="${PS1:-}"
PS1="($(basename $VIRTUAL_ENV)) ${PS1:-}"
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 2> /dev/null
fi