Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commite254cfb6d7e7570784c3223539f0811bd4190f22 (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-09-11 17:46:08 +0300
Committer
 Syndamia <kamen@syndamia.com>
2023-09-11 17:46:08 +0300
Filesf3d8df6fb5fb8307dfc57b39d38e20db5b138eee
syndamia.com-e254cfb6d7e7570784c3223539f0811bd4190f22.tar
syndamia.com-e254cfb6d7e7570784c3223539f0811bd4190f22.tar.gz
syndamia.com-e254cfb6d7e7570784c3223539f0811bd4190f22.zip
Parent1a9d6e4bd0da1857592f3535021bbf5da06bfaef (diff)
(generate.sh) Moved precommit logic into generate and removed all output from ssg
2 files changed, 11 insertions, 31 deletions
-rwxr-xr-x.hooks/pre-commit.sh30
-rwxr-xr-xgenerate.sh12
diff --git a/.hooks/pre-commit.sh b/.hooks/pre-commit.sh
deleted file mode 100755
index 39dbcaa..0000000
--- a/.hooks/pre-commit.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-
-# When copying/symlinking to .git/hooks/ remember to remove the filename extension!
-
-if [ -e "index.md" ]; then
- echo "Refusing to run in a folder that contains an index.md file, since it will be deleted. Are you sure you are running this script from the parent directory of the directory, inside root variable?"
- exit
-fi
-
-root='./src/'
-names=('about' 'archives' 'blog' 'tutorials' 'software' 'archived-websites' 'talks' 'misc')
-
-changes=0
-for name in ${names[@]}; do
- if ! cmp "$root$name.md" "$root$name/index.md" >/dev/null 2>&1; then
- cd "$root$name"
- if [ -f 'index.md' ]; then rm 'index.md'; fi
- ln "../$name.md" 'index.md'
- cd '../../'
- changes=1
- fi
-done
-
-if [ "$changes" -eq '1' ]; then
- echo '#========================================================================#'
- echo '# Index files have been fixed! Consider adding them into the commit too! #'
- echo '#========================================================================#'
-else
- echo 'Nothing was done!'
-fi
diff --git a/generate.sh b/generate.sh
index f9a20d2..9e6d10b 100755
--- a/generate.sh
+++ b/generate.sh
@@ -16,6 +16,16 @@
printf "%.3fs $1\n" $dur
}
# }}}
+# 0.5 Fix hardlinks {{{
+ startTimer
+ for folder in $(find "$REPO_FOLDER/src" -maxdepth 1 -type d); do
+ if [ -f "$folder.md" ] && [ ! "$folder.md" -ef "$folder/index.md" ]; then
+ rm "$folder/index.md" >/dev/null 2>&1
+ ln "$folder.md" "$folder/index.md"
+ fi
+ done
+ endTimer "[Stage 0.5] Fixed folder/index.md hardlinks"
+# }}}
# 1. Markdown source to HTML {{{
[ $# -eq 0 -a "$(id -u -n)" != "www-data" ] && echo "[Warning] Running in \"production\" by a user that isn't www-root!"
@@ -25,7 +35,7 @@
# Remove record of previously generated files
rm -f "$GEN_FOLDER/.files"
startTimer
- ssg "$REPO_FOLDER/src" "$GEN_FOLDER" "Syndamia" "https://syndamia.com" >/dev/null
+ ssg "$REPO_FOLDER/src" "$GEN_FOLDER" "Syndamia" "https://syndamia.com" >/dev/null 2>&1
endTimer "[Stage 1] Converted Markdown to HTML"
# }}}
# 1.5 Custom logic - timestamps.txt {{{