-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall.sh
executable file
·87 lines (58 loc) · 1.92 KB
/
install.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
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
82
83
84
85
86
87
#!/bin/bash
# colours
PRE="\033[" # prefix
NC="${PRE}0m" # no colour
LG="${PRE}0;32m" # light green
DG="${PRE}1;32m" # dark green
LR="${PRE}0;31m" # light red
BI="${PRE}1m${PRE}4m" # bold italics
# Python is needed only for word similarity prediction
#PYTHON2_COMMAND=$(python --version)
#PYTHON2_EXISTS=$?
# Checking if python exists
# Check if c++ is installed
if command -v c++ &> /dev/null
then
echo -e "${DG}C++ compiler is installed... Cool...!!!${NC}"
else
# Check if gcc is installed
if command -v gcc &> /dev/null
then
echo -e "${DG}Gcc compiler is installed... Cool...!!!${NC}"
fi
echo -e "${LR}C++ compiler is not installed on your system. Install c++ or gcc to use the ${BI}FastText-Node${LR} module${NC}"
fi
# Checking if git exists. Git is required for cloning fast text library
if command -v git &> /dev/null
then
echo -e "${DG}Git is installed... Cool...!!!${NC}"
else
echo -e "${LR}Git not installed in your system. Install git to use ${BI}FastText-Node${LR} module${NC}"
exit 1
fi
# Check if curl is installed
if command -v curl &> /dev/null
then
echo -e "${DG}Curl is installed... Cool...!!!${NC}"
else
echo -e "${LR}Curl not installed in your system. Install curl to use ${BI}FastText-Node${LR} module${NC}"
exit 1
fi
# Installing FastText-Node Module
echo -e "${DG}Installing FastText-Node Module${NC}"
echo -e "${LG}Downloading Fast Text Library${NC}"
# remove the existing folder else git throws an error
rm -rf fastText/
git clone https://github.com/facebookresearch/fastText.git
echo -e "${LG}Downloaded Fast Text Library.${NC}"
echo -e "${LG}Building the library${NC}"
cd fastText
make
echo -e "${LG}Built Fast Text Library.${NC}"
echo -e "${DG}Installed FastText-Node Library${NC}"
echo ""
cd ..
echo -e "${DG}Building node module${NC}"
ROOT=$(pwd)
${ROOT}/node_modules/.bin/grunt build
echo -e "${DG}Finished installing module${NC}"