-
Notifications
You must be signed in to change notification settings - Fork 126
/
Makefile
28 lines (26 loc) · 914 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
.PHONY: lint check_dupes install
sources :=$(wildcard ./exercises/**.json)
lint:
check-jsonschema --schemafile ./schema.json $(sources)
check_dupes:
# check for duplicate id's, if there's ID's listed here
# we've got duplicate id's that need to be resolved
jq -s ".[]" $(sources) | jq '.id' | sort | uniq -d
install:
pip install check-jsonschema
dist/exercises.json: $(sources)
# requires jq
# brew install jq (for macos)
jq -s '.' $^ > $@
dist/exercises.nd.json: $(sources)
# output to new line delimited JSON
# for use to import into PostgreSQL via the COPY command
#
# https://konbert.com/blog/import-json-into-postgres-using-copy
# https://www.postgresql.org/docs/current/sql-copy.html
jq -s '.[]' $^ > $@
dist/exercises.csv: dist/exercises.json
# output to csv format
# requires in2csv which is part of
# https://csvkit.readthedocs.io/
in2csv ./dist/exercises.json > $@