-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflip_addon.sh
executable file
·44 lines (34 loc) · 983 Bytes
/
flip_addon.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
#!/bin/bash
export ROOT=/path/to/cscart
ADDONS=()
ADDON_LIST=`cd $ROOT; git diff "HEAD@{1}" --name-only | egrep 'app/addons/.+?/addon.xml'`
if [ ! -z "$ADDON_LIST" ]; then
for file in $ADDON_LIST; do
OIFS=$IFS
IFS='/'
arrItems=($file)
ADDONS=("${ADDONS[@]}" ${arrItems[2]})
IFS=$OIFS
done
fi
ADDON_LIST=`cd $ROOT; git diff "HEAD@{1}" --name-only | grep 'var/themes_repository/basic/templates/addons/'`
if [ ! -z "$ADDON_LIST" ]; then
for file in $ADDON_LIST; do
OIFS=$IFS
IFS='/'
arrItems=($file)
ADDONS=("${ADDONS[@]}" ${arrItems[5]})
IFS=$OIFS
done
fi
function join { local IFS="$1"; shift; echo "$*"; }
if [ ! -z "$ADDONS" ]; then
if [ ${#ADDONS[@]} -gt 1 ]; then
CHANGED=($(printf "%s\n" "${ADDONS[@]}" | sort -u))
LIST=`join : "${CHANGED[@]}"`
else
LIST=${ADDONS[0]}
fi
echo "php $ROOT/bin/php_flip_addon.php $LIST"
php $ROOT/bin/php_flip_addon.php $LIST
fi