Skip to content

Commit ad08fce

Browse files
committed
2 parents bb2a67e + 3f0b7e4 commit ad08fce

File tree

1 file changed

+17
-42
lines changed

1 file changed

+17
-42
lines changed

install.sh

Lines changed: 17 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,9 @@ detect_profile() {
4141
}
4242
detect_profile
4343

44-
command -v node >/dev/null 2>&1 || {
45-
# No node! Install nvm
46-
echo >&2 "NodeJS is not found. Installing (using nvm)...";
47-
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash;
48-
source $DETECTED_PROFILE
49-
. $NVM_DIR/nvm.sh
50-
44+
set_node_version() {
5145
# Install nodejs v6.2.0
52-
echo "Installing nodejs v6.2.0"
46+
echo "Installing NodeJS v6.2.0"
5347
nvm install v6.2.0
5448
nvm alias default v6.2.0
5549

@@ -58,40 +52,21 @@ command -v node >/dev/null 2>&1 || {
5852
}
5953

6054
command -v node >/dev/null 2>&1 || {
61-
# No mongod!
62-
echo >&2 "MongoDB is not found. Installing...";
63-
if [[ `uname` == "Darwin" ]]; then
64-
brew install mongodb
65-
elif [[ "$(uname)" == 'Linux' ]]; then
66-
67-
if [[ -r /etc/os-release ]]; then
68-
# this will get the required information without dirtying any env state
69-
DIST_VERS="$( ( . /etc/os-release &>/dev/null
70-
echo "$ID $VERSION_ID") )"
71-
DISTRO="${DIST_VERS%% *}" # get our distro name
72-
VERSION="${DIST_VERS##* }" # get our version number
73-
elif [[ -r /etc/lsb-release ]]; then
74-
DIST_VERS="$( ( . /etc/lsb-release &>/dev/null
75-
echo "${DISTRIB_ID,,} $DISTRIB_RELEASE") )"
76-
DISTRO="${DIST_VERS%% *}" # get our distro name
77-
VERSION="${DIST_VERS##* }" # get our version number
78-
else # well, I'm out of ideas for now
79-
echo '==> Failed to determine distro and version.'
80-
exit 1
81-
fi
82-
83-
# Detect archlinux
84-
if [[ "$DISTRO" = "arch" ]]; then
85-
distribution="archlinux"
86-
sudo pacman -S mongodb
87-
# Detect Ubuntu
88-
elif [[ "$DISTRO" = "ubuntu" ]]; then
89-
export DEBIAN_FRONTEND=noninteractive
90-
sudo apt-get install mongodb
91-
else
92-
NEEDS_MONGO=true
93-
fi
94-
fi
55+
# No node! Install nvm
56+
echo >&2 "NodeJS is not found. Installing (using nvm)...";
57+
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash;
58+
source $DETECTED_PROFILE
59+
. $NVM_DIR/nvm.sh
60+
61+
set_node_version
62+
}
63+
64+
# Check node version supports arrow fns and string templates
65+
node -e '() => console.log(`print "3": ${1+2}`)' >/dev/null 2>&1 || {
66+
echo "Unsupported version of NodeJS."
67+
echo ""
68+
echo "Please update NodeJS to version 4.x.x or later (6.x.x recommended)"
69+
exit 1
9570
}
9671

9772
echo >&2 "Installing DeepForge...";

0 commit comments

Comments
 (0)