forked from ndwarshuis/CinnXP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
parse-all
executable file
·99 lines (80 loc) · 1.55 KB
/
parse-all
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
#! /bin/bash
set -e
THEME_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
declare -a VALID_GTK_VERSIONS=(18 20)
declare -a VALID_FLAVORS=('luna' 'homestead' 'metallic' 'royale' 'noir' 'embedded' 'zune')
help() {
cat << EOF
help: $0 options
parse all scss files for cinnamon and gtk
OPTIONS:
-h this...
-g parse only one gtk version (also skips cinnamon)
-c parse only cinnamon
EOF
}
elementIn () {
local e
for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
return 1
}
validate_sassc() {
if [ ! "$(which sassc 2> /dev/null)" ]; then
echo sassc not installed. See README
exit 1
fi
}
validate_gtk_minor_version() {
if ! $(elementIn "$1" "${VALID_GTK_VERSIONS[@]}"); then
echo "Invalid gtk versions requested."
help
exit
fi
}
parse_cinnamon() {
for flavor in "${VALID_FLAVORS[@]}"
do
echo "now parsing cinnamon for $flavor"
cd "$THEME_ROOT/theme-src/flavors/$flavor/cinnamon"
./parse-sass.sh > /dev/null
done
}
parse_gtk() {
gtk_version=$1
for flavor in "${VALID_FLAVORS[@]}"
do
echo "now parsing gtk-3.$gtk_version for $flavor"
cd "$THEME_ROOT/theme-src/flavors/$flavor/gtk-3.$gtk_version"
./parse-sass.sh > /dev/null
done
}
parse_all() {
for version in "${VALID_GTK_VERSIONS[@]}"
do
parse_gtk $version
done
parse_cinnamon
}
while getopts “hg:c” OPTION
do
case $OPTION in
h | \?)
help
exit 1
;;
g)
validate_gtk_minor_version $OPTARG
parse_gtk $OPTARG
exit
;;
c)
parse_cinnamon
exit
;;
*)
break
;;
esac
done
validate_sassc
parse_all