-
Notifications
You must be signed in to change notification settings - Fork 148
/
configure
81 lines (70 loc) · 1.4 KB
/
configure
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
#!/bin/bash
readonly NODE_VERSION='8.9.4'
readonly JAKE_VERSION='8.0.18'
function _has_nvm() {
which nvm || ls ~/.nvm > /dev/null 2>&1
}
function _check_nvm() {
printf "checking for nvm ... "
if _has_nvm; then
echo "yes"
return 0
else
echo "no"
return 1
fi
}
function _check_node() {
printf "checking for node ... "
local version=`node -v 2>/dev/null`
if [ "$version" = "v$NODE_VERSION" ]; then
echo "node@$version"
return 0
else
echo "no"
return 1
fi
}
function _check_jake() {
printf "checking for jake ... "
local version=`jake -v 2>/dev/null`
if [ "$version" = "$JAKE_VERSION" ]; then
echo "jake@$version"
return 0
else
echo "no"
return 1
fi
}
function _install_nvm() {
echo "installing nvm ..."
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
}
function _install_node() {
echo "installing node ..."
source ~/.nvm/nvm.sh
local cmd="nvm install v$NODE_VERSION"
echo $cmd
$cmd
}
function _npm_install() {
local cmd="npm install -g $1"
echo $cmd
$cmd
}
function _install_jake() {
echo "installing jake ..."
_npm_install "jake@$JAKE_VERSION"
}
function main() {
if _check_jake; then
printf ""
elif _check_node; then
_install_jake
elif _check_nvm; then
_install_node && _install_jake
else
_install_nvm && _install_node && _install_jake
fi
}
main $@ && echo "ok"