-
Notifications
You must be signed in to change notification settings - Fork 1
/
node.sh
45 lines (34 loc) · 1.08 KB
/
node.sh
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
source './homebrew.sh'
function clone_or_pull_repo {
local plugin_dir="$1"; shift 1;
local plugin_repo="$1"; shift 1;
if [ -d $plugin_dir/.git ]; then
current_dir="$PWD"
cd $plugin_dir
git pull
cd "$current_dir"
else
git clone $plugin_repo $plugin_dir
fi
}
function install_nodenv_plugin {
mkdir -p $NODENV_ROOT/plugins 2> /dev/null
local user="$1"; shift 1;
local plugin_name="$1"; shift 1;
local plugin_repo="https://github.com/$user/$plugin_name"
local plugin_dir="$NODENV_ROOT/plugins/$plugin_name"
clone_or_pull_repo $plugin_dir $plugin_repo
}
function install_node {
export NODENV_ROOT=/usr/local/var/nodenv
clone_or_pull_repo "$NODENV_ROOT" "https://github.com/OiNutter/nodenv.git"
ln -sf $NODENV_ROOT/bin/nodenv /usr/local/bin/
install_nodenv_plugin "OiNutter" "node-build"
if ! [ -d "/usr/local/var/nodenv/versions/0.10.33" ]; then
nodenv install 0.10.33
nodenv global 0.10.33
fi
$NODENV_ROOT/shims/npm install -g ember-cli
$NODENV_ROOT/shims/npm install -g jsonlint
$NODENV_ROOT/shims/npm install -g phantomjs
}