-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
29 lines (23 loc) · 984 Bytes
/
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
# get name of current directory
NAME := $(shell basename `pwd`)
SCHEME := $(NAME)-scheme.json
CONCEPTS := $(NAME)-concepts.ndjson
# run scripts as installed via npm to ensure stable version
jskos-convert=npm run --silent jskos-convert --
jskos-validate=npm run --silent jskos-validate --
# make scheme and concepts by default
default: $(SCHEME) $(CONCEPTS)
# jq 1.5 does not support del(..|nulls) syntax
nulls=recurse(.[]?;true)|select(.==null)
scheme-fields=uri,type,notation,prefLabel,identifier,publisher,altLabel,namespace,notationPattern,uriPattern
# download scheme file from BARTOC by default, reduce fields and validate
$(SCHEME):
[ -z "$(BARTOC)" ] || curl --silent https://bartoc.org/api/data?uri=$(BARTOC) \
| jq -eS '.[0]|{$(scheme-fields)}|del($(nulls))|if length>0 then . else false end' \
> $@ && $(jskos-validate) scheme $@
.PHONY: metrics
metrics:
./metrics.sh | jq -s > metrics.json
python:
python3 -m venv venv
venv/bin/pip install -r requirements.txt