This repository has been archived by the owner on Mar 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
activate
73 lines (61 loc) · 1.94 KB
/
activate
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
#!/bin/sh
# run me with . activate
OLD_PATH=$PATH
OLD_PS1=$PS1
OLD_NODE_PATH=$NODE_PATH
PATH=$(pwd)/bin:$(pwd)/node_modules/.bin:$PATH
# The default values for these environment variables below are:
# a) not secret; and,
# b) supposed to work with local demons (mongo)
export CU_DB=mongodb://localhost:27017/cu-test
export CU_BOX_SERVER=scraperwiki.example.com
export CU_SESSION_SECRET=foo
export CU_TOOLS_DIR=/var/tmp/tools
export [email protected]
export [email protected]
export CU_MAILCHIMP_API_KEY=foo
export CU_MAILCHIMP_LIST_ID=foo
# Fiddling with NODE_PATH appears not to be necessary. (node
# picks up modules from ./node_modules, but maybe that's only
# because i'm using nvm)
# Add ./code to NODE_PATH, adding a separating ':' if NODE_PATH
# is already set.
# See http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02
export NODE_PATH=$(pwd)/server/code${NODE_PATH+:}${NODE_PATH}
closest () {
# Searches parent directories to find the first one that contains
# "$1" then prints the full path, including the appended "$1".
# example use:
# cd $(closest swops-secret)
while ! [ -e "$1" ]
do
if [ "$(pwd)" = '/' ]
then
# Didn't find it, blank output
return 1
fi
cd ..
done
printf "%s\n" "$(pwd)/$1"
}
# let $here be the directory that contains the LICENCE file.
here=$(closest LICENCE)
here=$(dirname "$here")
thisdir=$(basename "$here")
first2=$(printf '%.2s' "$thisdir")
PS1="[$first2]$PS1"
deactivate () {
PATH=$OLD_PATH
PS1=$OLD_PS1
NODE_PATH=$OLD_NODE_PATH
unset -f deactivate
unset -f mocha
}
# Source script containing useful, but secret, environment variables.
. ../swops/archive/swops-secret/keys.sh
export ACK_OPTIONS="--type-add coffee=.coffee${ACK_OPTIONS+ $ACK_OPTIONS}"
alias ack=ack-grep
[[ -s ${HOME}/.nvm/nvm.sh ]] && . ${HOME}/.nvm/nvm.sh # This loads NVM
# Both mac-users and linux-users love nvm
nvm use 0.10
true