forked from afterlogic/aurora-files
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuilder.sh
executable file
·129 lines (93 loc) · 3.17 KB
/
builder.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
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
RED='\033[1;31m'
YELLOW='\033[1;33m'
GREEN='\033[1;32m'
NC='\033[0m' # No Color
DIR=$(cd `dirname $0` && pwd)
DIR_VUE="${DIR}/modules/AdminPanelWebclient/vue"
TASK="build"
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-t|--task)
TASK="$2"
shift # past argument
shift # past value
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
echo TASK: "$TASK"
if [ "$TASK" = "npm" ]; then
cd ${DIR}
npm install -g gulp-cli
npm install
if [ -d "$DIR_VUE" ]; then
cd ${DIR_VUE}
npm install
npm install -g @quasar/cli
fi
fi
if [ "$TASK" = "build" ]; then
./builder.sh -t build-main
./builder.sh -t build-admin
fi
if [ "$TASK" = "build-main" ]; then
cd ${DIR}
gulp styles --themes Default,DefaultDark,DeepForest,Funny,Sand --build a
gulp js:build --build a
gulp js:min --build a
#gulp test
fi
if [ "$TASK" = "build-admin" ]; then
if [ -d "$DIR_VUE" ]; then
cd ${DIR_VUE}
npm run build-production
fi
fi
if [ "$TASK" = "pack" ]; then
echo 'deny from all' > data/.htaccess
PRODUCT_VERSION=`cat VERSION`
if [ -f "$DEMO_MODULES_FILE" ]; then
PRODUCT_VERSION=`cat VERSION`
rm ${PRODUCT_NAME}_${PRODUCT_VERSION}.zip
fi
printf $GREEN"CREATING ZIP FILE: ${RED}${PRODUCT_NAME}_${PRODUCT_VERSION}.zip\n"$NC
zip -rq ${PRODUCT_NAME}_${PRODUCT_VERSION}.zip data/settings/config.json data/settings/modules data/.htaccess modules static system vendor dev adminpanel ".htaccess" dav.php index.php LICENSE VERSION README.md CHANGELOG.txt favicon.ico robots.txt package.json composer.json composer.lock gulpfile.js pre-config.json -x **/*.bak *.git* *node_modules/\*
fi
if [ "$TASK" = "upload" ]; then
cd ${DIR}
PRODUCT_VERSION=`cat VERSION`
echo UPLOAD ZIP FILE: "${PRODUCT_NAME}_${PRODUCT_VERSION}.zip"
curl -v --ftp-create-dirs --retry 6 -T ${PRODUCT_NAME}_${PRODUCT_VERSION}.zip -u ${FTP_USER}:${FTP_PASSWORD} ftp://afterlogic.com/
fi
if [ "$TASK" = "prepare-demo" ]; then
cd ${DIR}
printf "Adding extra modules at ${GREEN}${DIR}${NC}...\n"
curl -o ${DIR}/extra_modules.txt -u ${FTP_USER}:${FTP_PASSWORD} ftp://afterlogic.com/demo/${PRODUCT_NAME}/extra_modules.txt
# wget --no-parent --recursive --level=1 --no-directories --user=${FTP_USER} --password=${FTP_PASSWORD} ftp://afterlogic.com/demo/${PRODUCT_NAME}/
DEMO_MODULES_FILE="./extra_modules.txt"
if [ -f "$DEMO_MODULES_FILE" ]; then
printf $GREEN"Installing demo modules.\n"$NC
HAS_DEMO=`cat composer.json | grep -o --max-count=1 demo-mode-plugin`
if [ "${HAS_DEMO}" = "" ]; then
sed -i '/"require": {/r extra_modules.txt' composer.json
fi
php composer.phar update afterlogic/aurora-module-demo-mode-plugin
else
printf $RED"No extra_modules.txt file is found. Skipping this step.\n"$NC
fi
printf $GREEN"End 'prepare-demo' task\n"$NC
fi
if [ "$TASK" = "upload-demo" ]; then
cd ${DIR}
PRODUCT_VERSION=`cat VERSION`
echo UPLOAD ZIP FILE: "${PRODUCT_NAME}_${PRODUCT_VERSION}.zip"
curl -v --ftp-create-dirs --retry 6 -T ${PRODUCT_NAME}_${PRODUCT_VERSION}.zip -u ${FTP_USER}:${FTP_PASSWORD} ftp://afterlogic.com/demo/
fi