-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcrosware-cloc-source.sh
executable file
·52 lines (45 loc) · 1.28 KB
/
crosware-cloc-source.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
#!/usr/bin/env bash
#
# count lines of source in..
# - bin/, etc/profile, recipes/, ...
# - `crosware set` output
# to get a sense of how big runtime-expanded script/env is
#
cwtop="$(realpath $(dirname ${BASH_SOURCE[0]})/..)"
cw="${cwtop}/bin/crosware"
test -e "${cw}" || {
echo 'this does not look like crosware'
exit 1
}
export PATH="${PATH}:${cwtop}/software/cloc/current/bin:${cwtop}/software/perl/current/bin"
for p in cloc perl ; do
hash ${p} >/dev/null 2>&1 || {
echo "${p} not found"
exit 1
}
done
clocout="${cwtop}/tmp/cloc.out"
test -e "${clocout}" && cat "${clocout}" > "${clocout}.old" || true
(
echo 'crosware source:'
cwsi="${cwtop}/tmp/crosware_cloc_ignored.out"
cloc \
--lang-no-ext='Bourne Again Shell' \
--force-lang='Bourne Again Shell',sh{,.{common,main}} \
--ignored="${cwsi}" \
"${cwtop}/bin/" \
"${cwtop}/etc/profile" \
"${cwtop}/etc/functions" \
"${cwtop}/etc/vars" \
"${cwtop}/recipes/"
echo
cwso="${cwtop}/tmp/crosware.set.out"
test -e "${cwso}" && cat "${cwso}" > "${cwso}.old"
"${cw}" set > "${cwso}"
echo 'crosware set expanded:'
cloc \
--force-lang='Bourne Again Shell' \
"${cwso}"
echo "view diffs of ${cwso} with:"
echo " ${cwtop}/scripts/view-cloc-diff.sh"
) |& tee "${clocout}"