Skip to content

Commit 9eff2e2

Browse files
committed
[IPMPROG-1781] Add Makefile recipes to spellcheck(-interactive)
1 parent aa82b2a commit 9eff2e2

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-1
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
latest.json
2+
*.spellchecked
3+
*.bak

Makefile

+47-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,56 @@
33
OUTFILE = latest.json
44
PRODUCT = ipm
55
CONVERT = ./tools/convert.sh
6-
76
INPUTS = $(shell ls -1 "$(PRODUCT)"/*.md)
87

8+
EGREP = grep -E
9+
ASPELL = aspell
10+
ASPELL_LANG_ARG = en
11+
ASPELL_LANG_ENV = en_US.UTF-8
12+
# Must have a path component, goes to homedir otherwise
13+
ASPELL_DICT = ./relnotes.dict
14+
ASPELL_OUT_NOTERRORS = (^[ \t]*[\*\@]|^$$)
15+
916
all: $(OUTFILE)
1017

18+
check: spellcheck
19+
20+
clean:
21+
rm -f $(OUTFILE) $(addsuffix .spellchecked, $(INPUTS))
22+
# Interactive aspell leaves older copies of checked files; with Git we do not need them:
23+
rm -f $(addsuffix .bak, $(INPUTS))
24+
1125
$(OUTFILE): $(INPUTS)
1226
$(CONVERT) "$(PRODUCT)" "$(OUTFILE)"
27+
28+
spellcheck: $(addsuffix .spellchecked, $(INPUTS))
29+
30+
# Ported from NUT
31+
%.spellchecked: %
32+
@test -s "$<"
33+
@echo " SPELLCHECK $<" ; \
34+
OUT="`(sed 's,^\(.*\)$$, \1,' | \
35+
LANG=$(ASPELL_LANG_ENV) LC_ALL=$(ASPELL_LANG_ENV) \
36+
$(ASPELL) -a -M -p "$(ASPELL_DICT)" \
37+
-d "$(ASPELL_LANG_ARG)" --lang="$(ASPELL_LANG_ARG)" \
38+
--ignore-accents --encoding=utf-8 \
39+
) < "$<"`" \
40+
&& { if test -n "$$OUT" ; then OUT="`echo "$$OUT" | $(EGREP) -b -v '$(ASPELL_OUT_NOTERRORS)' `" ; fi; \
41+
test -z "$$OUT" ; } \
42+
|| { RES=$$? ; \
43+
echo "FAILED : Aspell reported errors here:" >&2 \
44+
&& echo "----- vvv" >&2 \
45+
&& echo "$$OUT" >&2 \
46+
&& echo "----- ^^^" >&2 ; \
47+
exit $$RES; }
48+
@touch "$@"
49+
50+
# Note: here we do not touch any files
51+
spellcheck-interactive: $(INPUTS)
52+
@for F in $^ ; do \
53+
echo " SPELLCHECK-INTERACTIVE $$F" ; \
54+
LANG=$(ASPELL_LANG_ENV) LC_ALL=$(ASPELL_LANG_ENV) \
55+
$(ASPELL) -c -M -p "$(ASPELL_DICT)" \
56+
-d "$(ASPELL_LANG_ARG)" --lang="$(ASPELL_LANG_ARG)" \
57+
--ignore-accents --encoding=utf-8 "$$F" ; \
58+
done

relnotes.dict

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
personal_ws-1.1 en 25
2+
AOS
3+
Automations
4+
EMPT
5+
IDE
6+
INDGW
7+
IPM
8+
LDAP
9+
MQTT
10+
Nutanix
11+
SCVMM
12+
SNMP
13+
VMs
14+
VMware
15+
VirtualBox
16+
Virtualization
17+
automations
18+
boolean
19+
hypervisor
20+
hypervisors
21+
runtime
22+
syslog
23+
vSAN
24+
vSphere
25+
vxRail
26+
webserver

0 commit comments

Comments
 (0)