forked from arthurevans/doctools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_modules.sh
92 lines (79 loc) · 3.33 KB
/
update_modules.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
##########################################################################################
##########################################################################################
## Purpose of Script ##
## ##
## Confirm that all necessary repos are accounted for and are current. ##
## ##
## Note: This script needs to be executed before the retrieval and update of the ##
## wiki guide2 space as it will update and wipe out the doctools/htmlguides directory. ##
## ##
## For more information visit ##
## https://wiki.appcelerator.org/x/dZzBAg ##
##########################################################################################
##########################################################################################
SECONDS=0
## create the appc_modules directory if it is missing
if [ ! -d $TI_ROOT/appc_modules ]; then
echo "appc_modules directory is missing. Creating that directory."
mkdir $TI_ROOT/appc_modules
fi
## cd into the modules directory
cd $TI_ROOT/appc_modules
updateModules () { ## check to see if a module exists and update it
echo "${blue}Updating/Retrieving ${green}$2${white}"
if [ $1 == "apidoc" ]; then ## if the first parameter is a module
ACTIVE=$TI_ROOT/appc_modules/$2
[email protected]:appcelerator-modules
elif [ $1 == "misc" ]; then ## if the first parameter is a repo
ACTIVE=$TI_ROOT/$2
[email protected]:appcelerator
elif [ $1 == "forked" ]; then ## if the first parameter is a forked repo
ACTIVE=$TI_ROOT/$2
GITHPATH=https://github.com/jawa9000/
fi
echo "Setting active directory to $ACTIVE"
if [ ! -d "$ACTIVE" ]; then ## if the repo doesn't exist, clone it
echo "Cloning $2"
if [ $1 == "apidoc" ]; then
cd $ACTIVE
elif [ $1 == "misc" ]; then
cd $TI_ROOT
fi
pwd
git clone $GITPATH/$2.git
else ## if the repo exists, update it
echo "$2 exists; updating"
cd $ACTIVE
git clean -dfx
git reset --hard HEAD
git pull origin master
fi
}
## array of apidoc modules to update from their respective repos
moduleArray=( appcelerator.apm appcelerator.https ti.cloud ti.coremotion ti.facebook ti.geofence ti.map ti.newsstand ti.nfc Ti.SafariDialog ti.touchid ti.urlsession )
## array of misc repos to update
repoArray=( appc-docs appc_web_docs arrow arrow-orm cloud_docs doctools titanium_mobile titanium_mobile_windows )
## forked repos to update
forkedArray=( alloy )
## loop through all arrays and update/clone as necessary
for i in "${moduleArray[@]}"
do
echo "Updating $i module"
updateModules apidoc $i
done
for i in "${repoArray[@]}"
do
echo "Updating $i repo"
updateModules misc $i
done
for i in "${forkedArray[@]}"
do
echo "Updating $i repo"
updateModules forked $i
echo "Make sure you put in a PR for $i"
done
## confirm that npm modules are installed in titanium_mobile and titanium_mobile_windows
sh updateNPMModules.sh
duration=$SECONDS
echo "$(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
say "Modules update complete"