-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathinstall_local.sh
executable file
·219 lines (203 loc) · 6.12 KB
/
install_local.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#!/bin/bash
RED='\033[0;31m'
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
if [ "$1" = "https" ]; then
CABLES_DEV_REPO="${CABLES_DEV_REPO:=https://github.com/cables-gl/cables_dev.git}"
CABLES_CORE_REPO="${CABLES_CORE_REPO:=https://github.com/cables-gl/cables.git}"
CABLES_API_REPO="${CABLES_API_REPO:=https://github.com/undev-studio/cables_api.git}"
CABLES_UI_REPO="${CABLES_UI_REPO:=https://github.com/cables-gl/cables_ui.git}"
CABLES_ELECTRON_REPO="${CABLES_ELECTRON_REPO:=https://github.com/cables-gl/cables_electron.git}"
CABLES_EXTENSION_OPS_REPO="${CABLES_EXTENSION_OPS_REPO:=https://github.com/cables-gl/cables_extensionops.git}"
CABLES_ASSET_LIBRARY_REPO="${CABLES_ASSET_LIBRARY_REPO:=https://github.com/cables-gl/cables-asset-library.git}"
else
CABLES_DEV_REPO="${CABLES_DEV_REPO:[email protected]:cables-gl/cables_dev.git}"
CABLES_CORE_REPO="${CABLES_CORE_REPO:[email protected]:cables-gl/cables.git}"
CABLES_API_REPO="${CABLES_API_REPO:[email protected]:undev-studio/cables_api.git}"
CABLES_UI_REPO="${CABLES_UI_REPO:[email protected]:cables-gl/cables_ui.git}"
CABLES_ELECTRON_REPO="${CABLES_ELECTRON_REPO:[email protected]:cables-gl/cables_electron.git}"
CABLES_EXTENSION_OPS_REPO="${CABLES_EXTENSION_OPS_REPO:[email protected]:cables-gl/cables_extensionops.git}"
CABLES_ASSET_LIBRARY_REPO="${CABLES_ASSET_LIBRARY_REPO:[email protected]:cables-gl/cables-asset-library.git}"
fi
COMMUNITY_BUILD=false
cables_electron="true";
if [[ "$*" == *"--community"* ]]
then
COMMUNITY_BUILD=true
cables_electron="false";
fi
export cables_electron;
CLEAN=false
if [ "$1" = "clean" ]; then
echo -e "${RED}Attempting a clean install, this will delete stuff, please confirm by pressing any key or stop here with ctrl-c...${NC}"
while [ true ] ; do
read -t 3 -n 1
if [ $? = 0 ] ; then
CLEAN=true;
break
fi
done
fi
ls ~/.nvm/nvm.sh > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e "nvm FOUND...";
if [[ `uname` == "Darwin" ]]; then
echo -e "DETECTED OSX...";
else
echo -e "ASSUMING LINUX/WSL..."
if [ "$COMMUNITY_BUILD" = "true" ]; then
echo -e "TRYING TO INSTALL DEPENDENCIES..."
sudo apt-get install python gcc g++ build-essential autoconf libpng-dev nasm
fi
fi
echo -e "LOADING nodejs VERSION" `cat .nvmrc`
source ~/.nvm/nvm.sh
nvm install `cat .nvmrc`
nvm use `cat .nvmrc`
nvm use
nvm alias default `cat .nvmrc`
else
node --version > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e "${RED}nvm NOT FOUND, RUNNING FOUND nodejs WITH VERSION${NC}" `node --version` "${RED} WANTED${NC}" `cat .nvmrc`;
else
echo -e "${RED}nvm NOT FOUND, nodejs NOT FOUND, PLEASE INSTALL VERSION${NC}" `cat .nvmrc`;
exit 1
fi
fi
set -e
set -o pipefail
npm install --no-save
echo -e ""
echo -e "${GREEN}INSTALLING SHARED...${NC}"
cd shared/
if [ "$CLEAN" = "true" ]; then
echo -e " ...deleting node modules";
rm -rf node_modules/
fi
git checkout develop
git pull
npm install --no-save
cd ..
echo -e ""
echo -e "${GREEN}INSTALLING CORE...${NC}"
if [ ! -d "cables/" ]; then
git clone ${CABLES_CORE_REPO}
fi
cd cables/
if [ "$CLEAN" = "true" ]; then
echo -e " ...deleting node modules";
rm -rf node_modules/
fi
git checkout develop
git pull
npm install --no-save
cd ..
echo -e ""
echo -e "${GREEN}INSTALLING EXTENSION OPS...${NC}";
if [ "$CLEAN" = "true" ]; then
echo -e " ...deleting extension ops";
rm -rf cables/src/ops/extensions
git clone ${CABLES_EXTENSION_OPS_REPO} cables/src/ops/extensions
fi
mkdir -p cables/src/ops/extensions
if [ -d "cables/src/ops/extensions/.git" ]; then
git -C cables/src/ops/extensions pull
else
git clone ${CABLES_EXTENSION_OPS_REPO} cables/src/ops/extensions
fi
if [ "$COMMUNITY_BUILD" = "true" ]; then
echo -e ""
echo -e "${GREEN}INSTALLING API..${NC}"
if [ ! -d "cables_api/" ]; then
git clone ${CABLES_API_REPO}
fi
cd cables_api/
if [ "$CLEAN" = "true" ]; then
echo -e " ...deleting node modules";
rm -rf node_modules/
fi
git checkout develop
git pull
npm install --no-save
cd ..
echo -e ""
echo -e "${GREEN}INSTALLING DEFAULT ASSETS...${NC}";
if [ "$CLEAN" = "true" ]; then
echo -e " ...deleting default assets";
rm -rf cables_api/public/assets/library
git clone ${CABLES_ASSET_LIBRARY_REPO} cables_api/public/assets/library
fi
mkdir -p cables_api/public/assets/library
if [ -d "cables_api/public/assets/library/.git" ]; then
git -C cables_api/public/assets/library pull
else
git clone ${CABLES_ASSET_LIBRARY_REPO} cables_api/public/assets/library
fi
fi
echo -e ""
echo -e "${GREEN}INSTALLING UI...${NC}"
if [ ! -d "cables_ui/" ]; then
git clone ${CABLES_UI_REPO}
fi
cd cables_ui/
if [ "$CLEAN" = "true" ]; then
echo -e " ...deleting node modules";
rm -rf node_modules/
fi
git checkout develop
git pull
npm install --no-save
cd ..
echo -e ""
echo -e "${GREEN}INSTALLING ELECTRON...${NC}"
if [ ! -d "cables_electron/" ]; then
git clone ${CABLES_ELECTRON_REPO}
fi
cd cables_electron/
if [ "$CLEAN" = "true" ]; then
echo -e " ...deleting node modules";
rm -rf node_modules/
fi
git pull
git checkout develop
npm install --no-save
cd ..
echo -e ""
echo -e "${GREEN}BUILDING SHARED...${NC}"
cd shared/
npm run build
cd ..
echo -e ""
echo -e "${GREEN}BUILDING CORE...${NC}"
cd cables/
npm run build
cd ..
if [ "$COMMUNITY_BUILD" = "true" ]; then
echo -e ""
echo -e "${GREEN}BUILDING API...${NC}"
cd cables_api/
npm run build
cd ..
fi
echo -e ""
echo -e "${GREEN}BUILDING UI...${NC}"
cd cables_ui/
npm run build
cd ..
echo -e ""
echo -e "${GREEN}BUILDING ELECTRON...${NC}"
cd cables_electron/
npm run build
cd ..
NPM_START_CMD="'npm run watch:standalone'"
echo -e ""
if [ "$COMMUNITY_BUILD" = "true" ]; then
NPM_START_CMD="'npm run start'"
echo -e "${YELLOW}BEFORE YOU RUN ${NPM_START_CMD} MAKE SURE YOUR NODE VERSION MATCHES" `cat .nvmrc` "BY RUNNING 'node --version'${NC}"
else
echo -e "${YELLOW}BEFORE YOU RUN ${NPM_START_CMD} MAKE SURE YOUR NODE VERSION MATCHES" `cat .nvmrc` "BY RUNNING 'node --version'${NC}"
echo -e "${YELLOW}...then change into cables_electron/ and run 'npm run start' to fire up cables standalone for development${NC}"
fi
echo -e ""