aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 0ced3c256c94219f74db29731781c49b729c5733 (plain)
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
all:
	make webrings
	make references
	make site
	make admin
	make migration

generators:
	make webrings
	make references

webrings:
	generators/openring/openring \
	-s "https://drewdevault.com/feed.xml" \
	-s "https://mxb.dev/feed.xml" \
	-s "https://www.taniarascia.com/rss.xml" \
	< generators/openring/template.html \
	> generators/hugo/themes/tdro/layouts/partials/webrings/openring.html

export DENO_DIR := generators/exoference/vendor

references:
	deno compile \
		--allow-net \
		--no-check \
		--output generators/exoference/exoference \
		generators/exoference/main.ts
	find generators/hugo/content/posts -type f -name "*.md" -exec basename --suffix '.md' {} \; \
		| while read -r file; do path="generators/hugo/themes/tdro/layouts/partials/references/$$file.html" \
		&& printf 'Gathering references for %s\n' "$$file" && [ ! -e "$$path" ] \
		&& generators/exoference/exoference "$$(printf 'https://thedroneely.com/posts/%s/\n' "$$file")" > \
		"$$path" || true ; done

site:
	ln -sfT ../../public generators/hugo/public
	cd generators/hugo && hugo && { cd ../.. || exit 1; }

admin:
	sed --in-place "s|^hugo_base_dir.*|hugo_base_dir: $$PWD/generators/hugo|" cockpit/addons/Hugo/config.yaml
	sed --in-place "s|^hugo_theme.*|hugo_theme: tdro|" cockpit/addons/Hugo/config.yaml

migration:
	sqlite3 database/sqlite.db < database/contactform.sql
	sed --in-place "s|'sql:;dbname=sql_database'|'sqlite:' . __DIR__ . '/database/sqlite.db'|" config.php

permissions:
	find . -type f -print0 | xargs -0 chmod 640
	find . -type d -print0 | xargs -0 chmod 770
	chmod +x \
		bootstrap/helpers/cache \
		bootstrap/helpers/thumbnails \
		generators/openring/openring
	chmod g+w database/sqlite.db
	find public/images -type f -exec touch -d "3 days ago" {} +

.PHONY: generators admin