-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
342 lines (260 loc) · 11.6 KB
/
Makefile
File metadata and controls
342 lines (260 loc) · 11.6 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
NO_DATASET=true
RENDER_COMMAND=python3 ./bin/render.py
second-pass:: specification guidance
include makerules/makerules.mk
include makerules/specification.mk
include makerules/render.mk
SPECIFICATION_CSV=\
specification/attribution.csv\
specification/award.csv\
specification/licence.csv\
specification/collection.csv\
specification/datapackage.csv\
specification/datapackage-dataset.csv\
specification/dataset.csv\
specification/dataset-field.csv\
specification/dataset-schema.csv\
specification/schema.csv\
specification/schema-field.csv\
specification/field.csv\
specification/fund.csv\
specification/datatype.csv\
specification/typology.csv\
specification/issue-type.csv\
specification/include-exclude.csv\
specification/severity.csv\
specification/prefix.csv\
specification/cohort.csv\
specification/intervention.csv\
specification/project.csv\
specification/project-organisation.csv\
specification/project-status.csv\
specification/requirement.csv\
specification/specification.csv\
specification/specification-field.csv\
specification/specification-reason.csv\
specification/specification-status.csv\
specification/organisation-dataset.csv\
specification/provision.csv\
specification/provision-reason.csv\
specification/provision-rule.csv\
specification/pipeline.csv\
specification/quality.csv\
specification/realm.csv\
specification/requirement-level.csv\
specification/role.csv\
specification/role-organisation.csv\
specification/theme.csv\
specification/guidance.csv\
specification/template.csv
# datasets needed to generate specifications and guidance
ORGANISATION_CSV=$(CACHE_DIR)organisation.csv
DATASETS=\
$(ORGANISATION_CSV)\
$(CACHE_DIR)local-plan-process.md\
$(CACHE_DIR)local-plan-event.md
specification:: $(SPECIFICATION_CSV)
# TBD: consider moving generating the guidance to the existing guidance repository?
guidance:
# made from dataset content ..
DATASET_MD=$(sort $(wildcard content/dataset/*.md))
specification/dataset.csv: $(DATASET_MD) bin/load-markdown.py $(CACHE_DIR)organisation.csv
@mkdir -p specification/
python3 bin/load-markdown.py $@ $(DATASET_MD)
ATTRIBUTION_MD=$(sort $(wildcard content/attribution/*.md))
specification/attribution.csv: $(ATTRIBUTION_MD) bin/load-markdown.py
@mkdir -p specification/
python3 bin/load-markdown.py $@ $(ATTRIBUTION_MD)
LICENCE_MD=$(sort $(wildcard content/licence/*.md))
specification/licence.csv: $(LICENCE_MD) bin/load-markdown.py
@mkdir -p specification/
python3 bin/load-markdown.py $@ $(LICENCE_MD)
DATATYPE_MD=$(sort $(wildcard content/datatype/*.md))
specification/datatype.csv: $(DATATYPE_MD) bin/load-markdown.py
python3 bin/load-markdown.py $@ $(DATATYPE_MD)
FIELD_MD=$(sort $(wildcard content/field/*.md))
specification/field.csv: $(FIELD_MD) bin/load-markdown.py
python3 bin/load-markdown.py $@ $(FIELD_MD)
PROJECT_MD=$(sort $(wildcard content/project/*.md))
specification/project.csv: bin/load-markdown.py
python3 bin/load-markdown.py $@ $(PROJECT_MD)
PROJECT_STATUS_MD=$(sort $(wildcard content/project-status/*.md))
specification/project-status.csv: $(PROJECT_STATUS_MD) bin/load-markdown.py
python3 bin/load-markdown.py $@ $(PROJECT_STATUS_MD)
TYPOLOGY_MD=$(sort $(wildcard content/typology/*.md))
specification/typology.csv: $(TYPOLOGY_MD) bin/load-markdown.py
python3 bin/load-markdown.py $@ $(TYPOLOGY_MD)
THEME_MD=$(sort $(wildcard content/theme/*.md))
specification/theme.csv: $(THEME_MD) bin/load-markdown.py
python3 bin/load-markdown.py $@ $(THEME_MD)
DATAPACKAGE_MD=$(sort $(wildcard content/datapackage/*.md))
specification/datapackage.csv: $(DATAPACKAGE_MD) bin/load-markdown.py
python3 bin/load-markdown.py $@ $(DATAPACKAGE_MD)
SPECIFICATION_MD=$(sort $(wildcard content/specification/*.md))
specification/specification.csv: $(SPECIFICATION_MD) bin/load-markdown.py
@mkdir -p specification/
python3 bin/load-markdown.py $@ $(SPECIFICATION_MD)
SPECIFICATION_REASON_MD=$(sort $(wildcard content/specification-reason/*.md))
specification/specification-reason.csv: $(SPECIFICATION_REASON_MD) bin/load-markdown.py
@mkdir -p specification/
python3 bin/load-markdown.py $@ $(SPECIFICATION_REASON_MD)
GUIDANCE_MD=$(sort $(wildcard content/guidance/*.md))
specification/guidance.csv: $(GUIDANCE_MD) bin/load-markdown.py
@mkdir -p specification/
python3 bin/load-markdown.py $@ $(GUIDANCE_MD)
TEMPLATE_MD=$(sort $(wildcard content/template/*.md))
specification/template.csv: $(TEMPLATE_MD) bin/load-markdown.py
@mkdir -p specification/
python3 bin/load-markdown.py $@ $(TEMPLATE_MD)
# made from the dataset.csv ..
DATASET_CSV=specification/dataset.csv
specification/collection.csv: $(DATASET_CSV) bin/collection.py
python3 bin/collection.py $@
specification/dataset-field.csv: $(DATASET_MD) $(DATASET_CSV) bin/dataset-field.py
python3 bin/dataset-field.py $@
specification/dataset-schema.csv: $(DATASET_CSV) bin/dataset-schema.py
python3 bin/dataset-schema.py $@
specification/schema.csv: $(DATASET_CSV) bin/schema.py
python3 bin/schema.py $@
specification/schema-field.csv: $(DATASET_CSV) bin/schema-field.py
python3 bin/schema-field.py $@
specification/pipeline.csv: $(DATASET_CSV) bin/pipeline.py
python3 bin/pipeline.py $@
specification/prefix.csv: content/prefix.csv
cp content/prefix.csv $@
specification/issue-type.csv: content/issue-type.csv
cp content/issue-type.csv $@
specification/severity.csv: content/severity.csv
cp content/severity.csv $@
specification/specification-status.csv: content/specification-status.csv
cp content/specification-status.csv $@
specification/specification-field.csv: $(DATASET_MD) $(DATASET_CSV) bin/specification-field.py
python3 bin/specification-field.py $@
specification/provision-reason.csv: content/provision-reason.csv
cp content/provision-reason.csv $@
specification/provision-rule.csv: content/provision-rule.csv
cp content/provision-rule.csv $@
specification/include-exclude.csv: content/include-exclude.csv
cp content/include-exclude.csv $@
specification/role-organisation-rule.csv: content/role-organisation-rule.csv
cp content/role-organisation-rule.csv $@
specification/intervention.csv: content/intervention.csv
cp content/intervention.csv $@
specification/fund.csv: content/fund.csv
cp content/fund.csv $@
specification/award.csv: content/award.csv
cp content/award.csv $@
specification/cohort.csv: content/cohort.csv
cp content/cohort.csv $@
specification/realm.csv: content/realm.csv
cp content/realm.csv $@
specification/requirement-level.csv: content/requirement-level.csv
cp content/requirement-level.csv $@
specification/role.csv: content/role.csv
cp content/role.csv $@
specification/quality.csv: content/quality.csv
cp content/quality.csv $@
specification/requirement.csv: content/requirement.csv
cp content/requirement.csv $@
specification/role-organisation.csv: bin/role-organisation.py specification/role-organisation-rule.csv $(CACHE_DIR)organisation.csv
python3 bin/role-organisation.py $@
specification/provision.csv: bin/provision.py specification/provision-rule.csv specification/project.csv specification/role-organisation.csv specification/project-organisation.csv
python3 bin/provision.py $@
#
# scrape webpages for project-organisation
#
# build organisations in a project
PROJECT_CSV=specification/project.csv
COHORT_CSV=specification/cohort.csv
AWARD_CSV=specification/award.csv
PROJECT_ORGANISATION_FILES=\
var/project-organisation/local-land-charges.csv\
var/project-organisation/local-plans-rollout.csv\
var/project-organisation/localgov-drupal.csv\
var/project-organisation/open-digital-planning.csv
specification/project-organisation.csv: $(PROJECT_ORGANISATION_FILES) bin/project-organisation.py
python3 bin/project-organisation.py $@ $(PROJECT_ORGANISATION_FILES)
#
# new local plans rollout ...
var/project-organisation/local-plans-rollout.csv: var/cache/local-plans-rollout.html $(ORGANISATION_CSV) bin/local-plans-rollout-parse.py
@mkdir -p $(dir $@)
python3 bin/local-plans-rollout-parse.py var/cache/local-plans-rollout.html $@
var/cache/local-plans-rollout.html:
@mkdir -p $(dir $@)
curl -L 'https://www.gov.uk/government/publications/rollout-of-the-new-local-plan-making-system/rollout-of-the-new-local-plan-making-system' > $@
# local land charges programme ..
var/project-organisation/local-land-charges.csv: var/cache/local-land-charges.html $(ORGANISATION_CSV) bin/llc-parse.py
@mkdir -p $(dir $@)
python3 bin/llc-parse.py var/cache/local-land-charges.html $@
var/cache/local-land-charges.html:
@mkdir -p $(dir $@)
curl -L 'https://www.gov.uk/government/publications/hm-land-registry-local-land-charges-programme/local-land-charges-programme' > $@
# localgov drupal project ..
var/project-organisation/localgov-drupal.csv: var/cache/localgov-drupal.html $(ORGANISATION_CSV) bin/lgd-parse.py
@mkdir -p $(dir $@)
python3 bin/lgd-parse.py var/cache/localgov-drupal.html $@
var/cache/localgov-drupal.html:
@mkdir -p $(dir $@)
curl -L -A 'MHCLG Planning Data Collector' 'https://localgovdrupal.org/community/our-councils' > $@
#
# open digital planning community ..
var/project-organisation/open-digital-planning.csv: $(COHORT_CSV) $(AWARD_CSV) $(ORGANISATION_CSV) bin/odp-community.py
@mkdir -p $(dir $@)
python3 bin/odp-community.py $@
# TBD: check anchors in every html file ..
render::
python3 bin/check-anchors.py docs/specification/plan/index.html
TESTING_DIR:=../testing-guidance/content/
TESTING_SNAPSHOT_DIR:=$(TESTING_DIR)$(shell date +%Y-%m-%d)/
render::
ifneq ("${TESTING_GUIDANCE}","")
mkdir -p $(TESTING_DIR) $(TESTING_SNAPSHOT_DIR)
mkdir -p $(TESTING_SNAPSHOT_DIR)
cp docs/guidance/development-plan/development-plan.md $(TESTING_DIR)
cp docs/guidance/development-plan/development-plan.md $(TESTING_SNAPSHOT_DIR)
cp docs/guidance/local-plan/local-plan.md $(TESTING_DIR)
cp docs/guidance/local-plan/local-plan.md $(TESTING_SNAPSHOT_DIR)
cp docs/guidance/local-plan-timetable/local-plan-timetable.md $(TESTING_DIR)
cp docs/guidance/local-plan-timetable/local-plan-timetable.md $(TESTING_SNAPSHOT_DIR)
cp docs/guidance/local-planning-authority/local-planning-authority.md $(TESTING_DIR)
cp docs/guidance/local-planning-authority/local-planning-authority.md $(TESTING_SNAPSHOT_DIR)
endif
#
# organisation-dataset has been deprecated, replaced by provision.csv ..
#
specification/organisation-dataset.csv: specification/provision.csv
cp specification/provision.csv $@
DATAPACKAGE_CSV=specification/datapackage.csv
specification/datapackage-dataset.csv: $(DATAPACKAGE_CSV) bin/datapackage-dataset.py
python3 bin/datapackage-dataset.py $@
commit-specification::
git add specification
git diff --quiet && git diff --staged --quiet || (git commit -m "Rebuilt specification $(shell date +%F)"; git push origin $(BRANCH))
clean::
rm -rf var/
clean clobber::
rm -f specification/*.csv
# generate mermaid diagrams
MERMAID_MD=$(subst content/specification/,docs/mermaid/,$(SPECIFICATION_MD))
render:: $(MERMAID_MD)
docs/mermaid/%.md: content/specification/%.md bin/specification-mermaid.py
@mkdir -p docs/mermaid/
python3 bin/specification-mermaid.py $< > $@
clobber::
rm -rf docs/mermaid/
init:: $(ORGANISATION_CSV)
# generate SVG diagrams
SPECIFICATION_SVG=$(subst .md,/diagram.svg,$(subst content/,docs/,$(SPECIFICATION_MD)))
render:: $(SPECIFICATION_SVG)
docs/specification/%/diagram.svg: content/specification/%.md bin/specification-svg.py
mkdir -p $(dir $@)
python3 bin/specification-svg.py $< > $@
render:: docs/dataset/diagram.svg docs/model.svg
docs/dataset/diagram.svg: specification/dataset-field.csv bin/datasets-svg.py
python3 bin/datasets-svg.py > $@
docs/model.svg: specification/dataset-field.csv bin/model-svg.py
python3 bin/model-svg.py > $@
fields.json:
python3 bin/dump-fields.py
extract-entity-ranges:
python3 bin/extract-entity-ranges.py