-
Notifications
You must be signed in to change notification settings - Fork 54
/
check-job-board-tags
executable file
·67 lines (57 loc) · 1.47 KB
/
check-job-board-tags
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
#!/usr/bin/env bash
#
#+ Usage: check-job-board-tags [-h|--help|-l|--list-only]
#+ -
#+ Performs a series of assertions about the relationship between
#+ different stacks' languages and features. Some stacks are intended to be
#+ subsets of others. Some stacks are meant to be mutually exclusive. These
#+ relationships are checked via the assert-job-board-tags script, which
#+ accepts batch inputs created by *this* script.
#+ -
set -o errexit
main() {
set -o pipefail
case "$1" in
-h | --help | help)
__usage
exit 0
;;
-l | --list-only)
CHECK_JOB_BOARD_TAGS_LIST_ONLY=1
;;
esac
COMBOS=(
languages:excl:opal:stevonnie
languages:excl:sardonyx:stevonnie
languages:excl:sardonyx:opal
features:incl:sardonyx:opal
)
cd "$(dirname "$(dirname "${BASH_SOURCE[0]}")")"
if [[ "${CHECK_JOB_BOARD_TAGS_LIST_ONLY}" ]]; then
for cmd in "${COMBOS[@]}"; do
echo "${cmd//:/ }"
done
exit 0
fi
BATCH_INPUT=""
for cmd in "${COMBOS[@]}"; do
IFS=':' read -r -a parts <<<"${cmd}"
rec="${parts[0]}:${parts[1]}"
rec="${rec}:./cookbooks/travis_ci_${parts[2]}/attributes/default.rb"
rec="${rec}:./cookbooks/travis_ci_${parts[3]}/attributes/default.rb"
BATCH_INPUT="$BATCH_INPUT
${rec}
"
done
echo "${BATCH_INPUT}" | ./bin/assert-job-board-tags -i |
grep --color -E '^✘:.*|$'
}
__usage() {
awk '/^#\+ / {
sub(/^#\+ /, "", $0) ;
sub(/-$/, "", $0) ;
print $0
}' \
"${0}"
}
main "$@"