From 2e219c7804c208545b0500b7da21334a58575e86 Mon Sep 17 00:00:00 2001 From: Thedro Neely Date: Sun, 13 Nov 2022 23:09:01 -0500 Subject: Makefile: Expose more deployment logic Generalize partials --- .gitignore | 4 +- Makefile | 43 ++++++++++++++++++---- .../hugo/themes/tdro/layouts/_default/single.html | 2 +- .../tdro/layouts/partials/article-on-web.html | 17 --------- .../tdro/layouts/partials/article-references.html | 6 +-- .../tdro/layouts/partials/article-webrings.html | 17 +++++++++ .../layouts/partials/generators/exoference/.keep | 0 .../layouts/partials/generators/openring/.keep | 0 .../themes/tdro/layouts/partials/references/.keep | 0 .../themes/tdro/layouts/partials/webrings/.keep | 0 10 files changed, 59 insertions(+), 30 deletions(-) delete mode 100644 generators/hugo/themes/tdro/layouts/partials/article-on-web.html create mode 100644 generators/hugo/themes/tdro/layouts/partials/article-webrings.html delete mode 100644 generators/hugo/themes/tdro/layouts/partials/generators/exoference/.keep delete mode 100644 generators/hugo/themes/tdro/layouts/partials/generators/openring/.keep create mode 100644 generators/hugo/themes/tdro/layouts/partials/references/.keep create mode 100644 generators/hugo/themes/tdro/layouts/partials/webrings/.keep diff --git a/.gitignore b/.gitignore index 0355f3b..06c9588 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,12 @@ -**/generators/exoference/*.html +**/references/*.html +**/webrings/*.html .hugo_build.lock /cockpit /database /storage /vendor config.php +generators/exoference/exoference generators/hugo/content generators/hugo/public generators/openring/openring diff --git a/Makefile b/Makefile index d412684..878ad30 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,40 @@ +all: + make webrings + make quotes + make references + make migration + make site + make admin + make migration + generators: - make openring - make fortune + make webrings + make quotes + make references -openring: +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/generators/openring/openring.html + > generators/hugo/themes/tdro/layouts/partials/webrings/openring.html -fortune: +quotes: strfile generators/fortune/quotes.fortune -hugo: +references: + 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; } -cockpit: +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 @@ -25,4 +42,14 @@ migration: sqlite3 database/sqlite.db < database/contactform.sql sed --in-place "s|'sql:;dbname=sql_database'|'sqlite:' . __DIR__ . '/database/sqlite.db'|" config.php -.PHONY: generators cockpit +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 diff --git a/generators/hugo/themes/tdro/layouts/_default/single.html b/generators/hugo/themes/tdro/layouts/_default/single.html index 1d98d73..9e67be6 100644 --- a/generators/hugo/themes/tdro/layouts/_default/single.html +++ b/generators/hugo/themes/tdro/layouts/_default/single.html @@ -10,7 +10,7 @@ {{- partial "article-syntax.html" . -}} {{- partial "article-meta-bottom.html" . -}} {{- partial "article-more-content.html" . -}} - {{- partial "article-on-web.html" . -}} + {{- partial "article-webrings.html" . -}} {{- partial "article-comments.html" . -}} {{- partial "article-references.html" . -}} diff --git a/generators/hugo/themes/tdro/layouts/partials/article-on-web.html b/generators/hugo/themes/tdro/layouts/partials/article-on-web.html deleted file mode 100644 index 53d1d45..0000000 --- a/generators/hugo/themes/tdro/layouts/partials/article-on-web.html +++ /dev/null @@ -1,17 +0,0 @@ -{{- $openring := "themes/tdro/layouts/partials/generators/openring/openring.html" -}} -{{- $include := "generators/openring/openring.html" -}} - -{{- if fileExists $openring -}} - -
- - - {{ safeHTML (readFile "public/css/icons/feather/help-circle.svg") }} - Openring - - -

On the Web

-
- {{- partial $include . -}} -
-{{- end -}} diff --git a/generators/hugo/themes/tdro/layouts/partials/article-references.html b/generators/hugo/themes/tdro/layouts/partials/article-references.html index ca3aee7..9de25c4 100644 --- a/generators/hugo/themes/tdro/layouts/partials/article-references.html +++ b/generators/hugo/themes/tdro/layouts/partials/article-references.html @@ -1,7 +1,7 @@ -{{- $exoference := print "themes/tdro/layouts/partials/generators/exoference/" .Slug ".html" -}} -{{- $include := print "generators/exoference/" .Slug ".html" -}} +{{- $references := print "themes/tdro/layouts/partials/references/" .Slug ".html" -}} +{{- $include := print "references/" .Slug ".html" -}} -{{- if fileExists $exoference -}} +{{- if fileExists $references -}}

References

diff --git a/generators/hugo/themes/tdro/layouts/partials/article-webrings.html b/generators/hugo/themes/tdro/layouts/partials/article-webrings.html new file mode 100644 index 0000000..2d8189b --- /dev/null +++ b/generators/hugo/themes/tdro/layouts/partials/article-webrings.html @@ -0,0 +1,17 @@ +{{- $webrings := "themes/tdro/layouts/partials/webrings/openring.html" -}} +{{- $include := "webrings/openring.html" -}} + +{{- if fileExists $webrings -}} + +
+ + + {{ safeHTML (readFile "public/css/icons/feather/help-circle.svg") }} + Openring + + +

On the Web

+
+ {{- partial $include . -}} +
+{{- end -}} diff --git a/generators/hugo/themes/tdro/layouts/partials/generators/exoference/.keep b/generators/hugo/themes/tdro/layouts/partials/generators/exoference/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/generators/hugo/themes/tdro/layouts/partials/generators/openring/.keep b/generators/hugo/themes/tdro/layouts/partials/generators/openring/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/generators/hugo/themes/tdro/layouts/partials/references/.keep b/generators/hugo/themes/tdro/layouts/partials/references/.keep new file mode 100644 index 0000000..e69de29 diff --git a/generators/hugo/themes/tdro/layouts/partials/webrings/.keep b/generators/hugo/themes/tdro/layouts/partials/webrings/.keep new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3