Use statdown and Renv
This commit is contained in:
0
.build_sentinel
Normal file
0
.build_sentinel
Normal file
18
Makefile
18
Makefile
@@ -74,13 +74,29 @@ serve: #> Start a Hugo server
|
||||
help: #> Generate this help message
|
||||
@gawk -f ${help_generator} $(MAKEFILE_LIST)
|
||||
|
||||
#-----------------------------------------------------------------------------#
|
||||
#
|
||||
# Rmd rendering via statdown
|
||||
#
|
||||
#-----------------------------------------------------------------------------#
|
||||
|
||||
# Discover all Rmd source files and derive their .md targets
|
||||
RMD_SOURCES := $(wildcard content/posts/*/index.Rmd)
|
||||
MD_TARGETS := $(RMD_SOURCES:.Rmd=.md)
|
||||
|
||||
# Pattern rule: render index.md from index.Rmd using statdown
|
||||
# Re-render when renv.lock changes (package version update)
|
||||
%/index.md: %/index.Rmd renv.lock
|
||||
@echo "🔄 Rendering $<"
|
||||
cd $* && Rscript -e 'renv::restore(prompt = FALSE); statdown::statdown_render("index.Rmd")'
|
||||
|
||||
#-----------------------------------------------------------------------------#
|
||||
#
|
||||
# Define file interface
|
||||
#
|
||||
#-----------------------------------------------------------------------------#
|
||||
|
||||
.build_sentinel: $(wildcard content/*/*)
|
||||
.build_sentinel: $(MD_TARGETS) $(wildcard content/*/*)
|
||||
@echo "\t 🏗️ Building site"
|
||||
@# We call hugo with two options:
|
||||
@# --cleanDestinationDir, to remove deleted files
|
||||
|
||||
7
renv/.gitignore
vendored
Normal file
7
renv/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
library/
|
||||
local/
|
||||
cellar/
|
||||
lock/
|
||||
python/
|
||||
sandbox/
|
||||
staging/
|
||||
1419
renv/activate.R
Normal file
1419
renv/activate.R
Normal file
File diff suppressed because it is too large
Load Diff
20
renv/settings.json
Normal file
20
renv/settings.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"bioconductor.version": null,
|
||||
"external.libraries": [],
|
||||
"ignored.packages": [],
|
||||
"package.dependency.fields": [
|
||||
"Imports",
|
||||
"Depends",
|
||||
"LinkingTo"
|
||||
],
|
||||
"ppm.enabled": null,
|
||||
"ppm.ignored.urls": [],
|
||||
"r.version": null,
|
||||
"snapshot.dev": false,
|
||||
"snapshot.type": "implicit",
|
||||
"use.cache": true,
|
||||
"vcs.ignore.cellar": true,
|
||||
"vcs.ignore.library": true,
|
||||
"vcs.ignore.local": true,
|
||||
"vcs.manage.ignores": true
|
||||
}
|
||||
11
scripts/renv.lock
Normal file
11
scripts/renv.lock
Normal file
@@ -0,0 +1,11 @@
|
||||
pak::pkg_install(
|
||||
c(
|
||||
"knitr",
|
||||
"tidyverse",
|
||||
"reactable",
|
||||
"htmltools",
|
||||
"svglite"
|
||||
)
|
||||
)
|
||||
renv::snapshot()
|
||||
# vim: ft=r
|
||||
16
scripts/watch-rmd.sh
Normal file
16
scripts/watch-rmd.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
WATCH_DIR="content/posts"
|
||||
|
||||
echo "🚨 Watching ${WATCH_DIR} for changes..."
|
||||
|
||||
inotifywait -m -e close_write --format '%w%f' -r "$WATCH_DIR" | while read FILE; do
|
||||
if [[ "$FILE" == *.Rmd ]]; then
|
||||
POST_DIR=$(dirname "$FILE")
|
||||
|
||||
echo "🔄 Change detected in $FILE. Rendering..."
|
||||
|
||||
(cd "$POST_DIR" && Rscript -e 'renv::restore(prompt = FALSE); statdown::statdown_render("index.Rmd")')
|
||||
|
||||
echo "✅ Rendered ${FILE}"
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user