-
Notifications
You must be signed in to change notification settings - Fork 33
/
build.sh
executable file
·108 lines (94 loc) · 1.91 KB
/
build.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
#!/bin/bash
# Script de construction des bundles
# ./build.sh -a(all)
# -o(openlayers)
# -l(leaflet)
# -i(itowns)
# FIXME incompatibilité avec un env. Windows
##########
# doCmd()
doCmd () {
cmd2issue=$1
eval ${cmd2issue}
retour=$?
if [ $retour -ne 0 ] ; then
printTo "Erreur d'execution (code:${retour}) !..."
exit 100
fi
}
##########
# printTo()
printTo () {
text=$1
d=`date`
echo "[${d}] ${text}"
}
printTo "BEGIN"
##########
# clean
function clean() {
# pas de tests...
printTo "####### CLEAN !"
doCmd "rm -rf dist/$1"
doCmd "rm -rf samples/$1"
doCmd "rm -rf jsdoc/$1"
}
##########
# leaflet
function leaflet() {
printTo "####### LEAFLET !"
doCmd "npm run build:leaflet"
}
##########
# ol
function ol() {
printTo "####### OL !"
doCmd "npm run build:ol"
}
##########
# itowns
function itowns() {
printTo "####### iTowns !"
doCmd "npm run build:itowns"
}
printTo "########### NPM ##############"
doCmd "npm run setup"
while getopts "aoliI" opts
do
case $opts in
o)
printTo "#################################"
printTo "###### OpenLayers bundle ! ######"
clean "openlayers"
ol
;;
l)
printTo "#################################"
printTo "####### Leaflet bundle ! ########"
clean "leaflet"
leaflet
;;
i)
printTo "#############################"
printTo "###### Itowns bundle ! ######"
clean "itowns"
itowns
;;
a)
printTo "#################################"
printTo "########## ALL bundle ! #########"
clean "openlayers"
ol
clean "leaflet"
leaflet
clean "itowns"
itowns
;;
\?)
printTo "$OPTARG : option invalide : a(all), o(openlayers), l(leaflet), i(itowns) !"
exit -1
;;
esac
done
printTo "END"
exit 0