forked from sofa/app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run
executable file
·93 lines (81 loc) · 2.65 KB
/
run
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
#!/bin/bash
# Colors
ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
COL_GREEN=$ESC_SEQ"32;01m"
COL_YELLOW=$ESC_SEQ"33;01m"
COL_BLUE=$ESC_SEQ"34;01m"
COL_MAGENTA=$ESC_SEQ"35;01m"
COL_CYAN=$ESC_SEQ"36;01m"
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
function program_is_installed {
# set to 1 initially
local return_=1
# set to 0 if not found
type $1 >/dev/null 2>&1 || { local return_=0; }
# return value
echo "$return_"
}
# display a message in red with a cross by it
# example
# echo echo_fail "No"
function echo_fail {
echo -e "$COL_RED ✘ ${1} $COL_RESET"
}
# display a message in green with a tick by it
# example
# echo echo_fail "Yes"
function echo_pass {
echo -e "$COL_GREEN ✔ ${1} $COL_RESET"
}
function echo_green {
echo -e "$COL_GREEN ${1} $COL_RESET"
}
function echo_yellow {
echo -e "$COL_YELLOW ${1} $COL_RESET"
}
function echo_magenta {
echo -e "$COL_MAGENTA ${1} $COL_RESET"
}
if [ $(program_is_installed npm) != 1 ]
then
echo_fail "Can't start installation \n ERROR: Missing 'npm' command, please make sure to install NodeJS first.";
exit
fi
if [ $(program_is_installed bower) != 1 ]
then
echo_fail "Can't start installation \n ERROR: Missing 'bower' command, please make sure to install Bower first.";
echo_yellow "You can install Bower using the command"
echo_magenta " npm install -g bower";
exit
fi
if [ $(program_is_installed grunt) != 1 ]
then
echo_fail "Can't start installation \n ERROR: Missing 'grunt' command, please make sure to install GruntJS first.";
echo_yellow "You can install GruntJS using the command";
echo_magenta " npm install -g grunt-cli";
exit
fi
if [ $(program_is_installed compass) != 1 ]
then
echo_fail "Can't start installation \n ERROR: Missing 'compass' command, please make sure to install Ruby and Compass first.";
echo_yellow "Please find the correct Ruby installation instructions for your system.";
echo_yellow "Once done, you can install Compass using the command"
echo_magenta " gem install compass";
echo_yellow "Note that you may need to use sudo for the above command."
exit
fi
echo_pass "npm installed";
echo_pass "bower installed";
echo_yellow " Installing node dependencies...";
npm install
echo_pass "node dependencies installed"
echo_yellow " Installing bower dependencies...";
bower install --allow-root
echo_pass "bower dependencies installed"
echo_pass "Dependencies installed successfully"
echo_green "Starting app at localhost port 9000..."
grunt watch