-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
executable file
·119 lines (89 loc) · 2.47 KB
/
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
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
#!/bin/bash -e
# Meta
version="0.25.1"
prefix="dev"
# vars
scriptpath="$(dirname $0)"
functions="$(dirname $0)/functions"
config="$scriptpath/config.conf"
#mysql_path='/Applications/MAMP/Library/bin/mysql'
#mysqldump_path='/Applications/MAMP/Library/bin/mysqldump'
#mysqlshow_path='/Applications/MAMP/Library/bin/mysqlshow'
#mysqladmin_path='/Applications/MAMP/Library/bin/mysqladmin'
devkit_conf=".devkit/site_cloner.conf"
vhosts_conf='.devkit/vhosts.conf'
vhosts_path='/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf'
# Colors
error='\033[0;31m'
warning='\033[0;33m'
success='\033[0;32m'
cmd='\033[0;36m'
end='\033[0m'
greprc=$?
# Space
NL=$'\\n'
# Functions
for file in $functions/*.sh ; do
if [ -f "$file" ] ; then
. "$file"
fi
done
for file in $functions/*/*.sh ; do
if [ -f "$file" ] ; then
. "$file"
fi
done
# Check if config file has been created
if [ ! -f "$config" ]; then
config_template
setup
fi
source $config
# Function call
if [ "$setup" == "false" ] || [ "$1" == "setup" ] ; then
setup $2
elif [ "$1" == "" ] || [ "$1" == "-h" ] || [ "$1" == "--help" ] ; then
help
elif [ "$1" == "-v" ] || [ "$1" == "version" ] ; then
version
elif [ "$1" == "update" ] ; then
update
elif [ "$1" == "-o" ] || [ "$1" == "open" ] ; then
open_site
elif [ "$1" == "new" ] ; then
new $2
elif [ "$1" == "clone" ] ; then
clone $2
elif [ "$1" == "valet" ] ; then
clone_valet $2
elif [ "$1" == "remove" ] ; then
remove
elif [ "$1" == "db" ] || [ "$1" == "database" ] ; then
database $2
elif [ "$1" == "-w" ] || [ "$1" == "wpe" ] ; then
wpe $2
elif [ "$1" == "-t" ] || [ "$1" == "test" ] ; then
test_site
elif [ "$1" == "mamp" ] ; then
mamp $2
elif [ "$1" == "hosts" ] ; then
open /private/etc/hosts
elif [ "$1" == "vhosts" ] ; then
open /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
elif [ "$1" == "phpmyadmin" ] ; then
open http://localhost/phpmyadmin
elif [ "$1" == "ssh" ] ; then
connect_ssh
elif [ "$1" == "backup" ] ; then
backup $2
elif [ "$1" == "cache" ] ; then
cache
elif [ "$1" == "github" ] || [ "$1" == "gh" ] ; then
github
elif [ "$1" == "testfile" ] ; then
testfile
else
echo -e "${error}Command not found.${NL}${end}Try ${prefix} help"
exit 1
fi
# Written by Rostislav Melkumyan 2020