Summary Files Commits Branches @commit @diff @stats
path: root / generate-dev.sh
diff options
context:
space:
mode:
Commit0187e255a811bebb0dad3624f2c6d78b829d15c5 (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-01-17 16:15:28 +0200
Committer
 Syndamia <kamen@syndamia.com>
2023-01-17 16:15:28 +0200
Files68efd3520e72c8c8c553fdda7b9391d9ec4e9feb /generate-dev.sh
syndamia.com-0187e255a811bebb0dad3624f2c6d78b829d15c5.tar
syndamia.com-0187e255a811bebb0dad3624f2c6d78b829d15c5.tar.gz
syndamia.com-0187e255a811bebb0dad3624f2c6d78b829d15c5.zip
Parentda000c477625bb533688df84bd95ba3a3aff3246 (diff)
[awk] Reworked generation to happen via a combined script, updated scripts and added info in scripts readme
1 files changed, 17 insertions, 8 deletions
-rwxr-xr-xgenerate-dev.sh25
diff --git a/generate-dev.sh b/generate-dev.sh
index 1e1c2ed..0fa8593 100755
--- a/generate-dev.sh
+++ b/generate-dev.sh
@@ -12,17 +12,26 @@ rm -f /var/www/synd/.files
# Generate files
ssg src /var/www/synd/ "Syndamia" "https://syndamia.com" > /dev/null
-allnormfiles=$(find '/var/www/synd' -type f -name "*.html")
dur=0
-
-for script in $(find "./generate-hooks" -type f -name "*.awk"); do
+startTimer () {
dur="$(date +%s%N)"
- for file in $allnormfiles; do
- awk -f "$script" "$file" > tmp && mv -f tmp "$file"
- done
+}
+endTimer () {
dur="$(echo "scale=4 ; ($(date +%s%N) - $dur) / 1000000000" | bc -l)"
- printf "%.3fs $script\n" $dur
-done
+ printf "%.3fs $1\n" $dur
+}
+
+startTimer
+ find './awk-edits' -type f -name "[A-Z]*.awk" -exec cat {} + > /tmp/syndamiadotcom-awk
+ find './awk-edits' -type f -name "_*.awk" -exec cat {} + >> /tmp/syndamiadotcom-awk
+ find './awk-edits' -type f -name "[a-z]*.awk" -exec cat {} + >> /tmp/syndamiadotcom-awk
+endTimer "generation of /tmp/syndamiadotcom-awk"
+
+startTimer
+ for file in $(find '/var/www/synd' -type f -name "*.html"); do
+ awk -f '/tmp/syndamiadotcom-awk' "$file" > tmp && mv -f tmp "$file"
+ done
+endTimer "/tmp/syndamiadotcom-awk"
#
# Tiny version