-
Notifications
You must be signed in to change notification settings - Fork 34
/
makefile
106 lines (87 loc) · 2.5 KB
/
makefile
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
## (@)Id: makefile automates the build and deployment for python projects
## Build config
#
# type of project
PROJ_TYPE = python
PROJ_MODULES = git python-resources python-cli python-doc python-doc-deploy
INFO_TARGETS += appinfo
ADD_CLEAN += zotero-site
# add app configuration to command line arguments
PY_CLI_ARGS += -c test-resources/zotsite.conf
# add integration tests to test run
PY_TEST_DEPS += testintegration
# Project
#
COLL_ARGS = "^(?:NLP|Earth).*"
ENTRY= ./zotsite
WEB_PKG_DIR= $(MTARG)/site
SITE_DEMO = doc/demo
PY_DOC_BUILD_HTML_DEPS += cpdemo
## Includes
#
include ./zenbuild/main.mk
## Targets
#
.PHONY: appinfo
appinfo:
@echo "app-resources-dir: $(RESOURCES_DIR)"
# export all
.PHONY: export
export:
$(ENTRY) $(PY_CLI_ARGS)
# export a subset of the collection
.PHONY: exportsubset
exportsubset:
$(ENTRY) --collection $(COLL_ARGS) $(PY_CLI_ARGS)
# print a collections metadata
.PHONY: print
print:
$(ENTRY) print --collection $(COLL_ARGS) $(PY_CLI_ARGS)
# test metadata output for entire library
.PHONY: testprintall
testprintall:
@$(ENTRY) print --level warn $(PY_CLI_ARGS) | \
diff - test-resources/integration/export-all.txt || \
exit 1
@echo "print all integration test ... ok"
# test metadata output for a collection
.PHONY: testprintcol
testprintcol:
@$(ENTRY) print --level warn \
--collection $(COLL_ARGS) $(PY_CLI_ARGS) | \
diff - test-resources/integration/export-coll.txt || \
exit 1
@echo "print collection integration test ... ok"
# test BetterBibtex citation key lookup
.PHONY: testcitekey
testcitekey:
@$(ENTRY) citekey --level warn -k all | \
sort | \
diff - test-resources/integration/citekey.txt || \
exit 1
@echo "BetterBibtex citekey integration test ... ok"
# test paper document (PDF) path lookup
.PHONY: testdocpath
testdocpath:
@$(ENTRY) docpath --level warn -k all | \
sort | \
diff - test-resources/integration/docpath.txt || \
exit 1
@echo "document path lookup integration test ... ok"
# all integration tests
.PHONY: testintegration
testintegration: testprintall testprintcol testcitekey testdocpath
# create the demo site
.PHONY: demo
demo: clean
rm -fr $(SITE_DEMO)
$(ENTRY) $(PY_CLI_ARGS) \
export -o $(SITE_DEMO) \
--collection $(COLL_ARGS)
touch $(SITE_DEMO)/.nojekyll
# copy the demo site to the GitHub pages install location
.PHONY: cpdemo
cpdemo:
@echo "copy zotsite demo"
mkdir -p $(PY_DOC_BUILD_HTML)
cp -r $(SITE_DEMO) $(PY_DOC_BUILD_HTML)