-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
executable file
·61 lines (55 loc) · 1000 Bytes
/
start.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
#!/bin/bash
PROJECT_PATH=$(dirname "$0")
installHomebrew() {
printf "\nInstalling Homebrew...\n"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" &&
brew update
}
installNode() {
printf "\nInstalling Node.js...\n"
brew install node
}
installDependencies() {
printf "\nChecking dependencies...\n\n"
printf "You might need to type your password\n"
printf "don't be afraid!\n"
cd "$PROJECT_PATH"
sudo npm install
}
createLockFile() {
cd "$PROJECT_PATH" &&
touch .install.lock
}
run() {
printf "\nLet's start this thing...\n"
cd "$PROJECT_PATH" &&
npm start
}
cd "$PROJECT_PATH" &&
if [ ! -f .install.lock ];
then
type node >/dev/null 2>&1
if [ $? -eq 1 ]
then
type brew >/dev/null 2>&1
if [ $? -eq 1 ]
then
installHomebrew
installNode
installDependencies
createLockFile
run
else
installNode
installDependencies
createLockFile
run
fi
else
installDependencies
createLockFile
run
fi
else
run
fi