-
Notifications
You must be signed in to change notification settings - Fork 3
/
.envrc
78 lines (57 loc) · 2.58 KB
/
.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
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
# vim: ft=bash
export OS=$(uname -s | tr '[A-Z]' '[a-z]')
if [[ $OS == "darwin" ]]; then
export brew_prefix="$(brew --prefix)"
export VOLTA_HOME=${HOME}/.volta
pg_pkg="postgresql@$(cat .postgresql-version)"
pg_dir="$(brew --prefix "${pg_pkg}")/bin/"
[[ -d "${pg_dir}" ]] && PATH_add "${pg_dir}"
PATH_add /opt/homebrew/bin
PATH_add ${VOLTA_HOME}/bin
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
export V8HOME=$(brew --prefix v8)
export CPPFLAGS="$CPPFLAGS -I ${brew_prefix}/include -I ${V8HOME}/include"
export LDFLAGS="$LDFLAGS -L ${brew_prefix}/lib -L ${V8HOME}/lib"
fi
#———————————————————————————————————————————————————————————
# Add all the node module's bin paths to the $PATH
# Set "export PATH_DEBUG=1" to see what's happening here.
#———————————————————————————————————————————————————————————
declare -a node_bin_paths
export PATH_DEBUG=1
# save old $PATH
previous_path="${PATH}"
for dir in $(find node_modules -type d -name bin); do
PATH_add "${dir}"
done
PATH_add bin
# Re-add the old $PATH at the beginning; now we have it duplicated.
PATH_add "${previous_path}"
# Now we unique all the paths, but preserve the order
unique_path_file="/tmp/paths.tmp"
export root_dir="$(pwd -P)"
(
set -e
source ${root_dir}/development/shell-lib.sh
# uniq the paths
array.join ':' $(path.dirs.uniq)
) > "${unique_path_file}"
export NEW_PATH=$(/bin/cat "${unique_path_file}")
[[ -n ${NEW_PATH} ]] && {
# We need to unset $PATH completely, otherwise direnv takes over.
# This is dangerous! If we `
unset PATH
export PATH="${NEW_PATH}"
}
rm -f "${unique_path_file}"
echo -e "\e[1;35mHINT: use bin/print-paths to see the ordering of your \$PATH variable.\e[0;0m"
#———————————————————————————————————————————————————————————
# End of PATH modifications
#———————————————————————————————————————————————————————————
export CFLAGS="-Wno-error=implicit-function-declaration -Wno-error=no-compound-token-split-by-macro"
[[ -n ${CPPFLAGS} ]] && export RUBY_CPPFLAGS="$CPPFLAGS"
export RUBY_CFLAGS="$CFLAGS"
[[ -f .envrc.local ]] && source .envrc.local
if [[ $(uname -s) == "Darwin" ]]; then
export BULLET_ENABLED=true
fi