summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2022-05-29 08:55:15 +0100
committerPaul Buetow <paul@buetow.org>2022-05-29 08:55:15 +0100
commit05760b5505df4356e5b076a3e6bf0fd0056e052f (patch)
tree015ec3549040f38da696eaab99e129d407a5f139 /lib
parent252432fae23e58f97b825f855ece4f6e8e1cf39f (diff)
strip out the git auto commit feature - as it was partly broken and difficult to fix
Diffstat (limited to 'lib')
-rw-r--r--lib/atomfeed.source.sh3
-rw-r--r--lib/gemfeed.source.sh2
-rw-r--r--lib/generate.source.sh16
-rw-r--r--lib/git.source.sh81
-rw-r--r--lib/notes.source.sh12
5 files changed, 11 insertions, 103 deletions
diff --git a/lib/atomfeed.source.sh b/lib/atomfeed.source.sh
index dd2b28c..716ef5c 100644
--- a/lib/atomfeed.source.sh
+++ b/lib/atomfeed.source.sh
@@ -26,12 +26,10 @@ local meta_email="$EMAIL"
local meta_title="$title"
local meta_summary="$summary. .....to read on please visit my site."
META
- git::add meta "$meta_file"
return
fi
cat "$meta_file"
- git::add meta "$meta_file"
}
# Retrieve the core content as XHTML of the blog post.
@@ -111,7 +109,6 @@ ATOMFOOTER
if ! diff -u <($SED 3d "$atom_file") <($SED 3d "$atom_file.tmp"); then
log INFO 'Feed got something new!'
mv "$atom_file.tmp" "$atom_file"
- git::add gemtext "$atom_file"
else
log INFO 'Nothing really new in the feed'
rm "$atom_file.tmp"
diff --git a/lib/gemfeed.source.sh b/lib/gemfeed.source.sh
index ee5623f..1b2ee5c 100644
--- a/lib/gemfeed.source.sh
+++ b/lib/gemfeed.source.sh
@@ -22,7 +22,6 @@ gemfeed::updatemainindex () {
"$gemfeed_dir/index.gmi" >> "$index_gmi.tmp"
mv "$index_gmi.tmp" "$index_gmi"
- git::add gemtext "$index_gmi"
}
gemfeed::_get_word_count () {
@@ -58,7 +57,6 @@ GEMFEED
done < <(gemfeed::get_posts)
mv "$gemfeed_dir/index.gmi.tmp" "$gemfeed_dir/index.gmi"
- git::add gemtext "$gemfeed_dir/index.gmi"
gemfeed::updatemainindex
}
diff --git a/lib/generate.source.sh b/lib/generate.source.sh
index 14642af..5482beb 100644
--- a/lib/generate.source.sh
+++ b/lib/generate.source.sh
@@ -42,7 +42,6 @@ generate::fromgmi_add_docs () {
mkdir -p "$dest_dir"
fi
cp "$src" "$dest"
- git::add "$format" "$dest"
}
# Remove docs from output format which aren't present in Gemtext anymore.
@@ -53,7 +52,7 @@ generate::fromgmi_cleanup_docs () {
dest=${dest/$format/gemtext}
if [[ ! -f "$dest" ]]; then
- git::rm "$format" "$src"
+ rm "$src"
fi
}
@@ -69,8 +68,6 @@ generate::convert_gmi_atom_to_html_atom () {
$SED 's|.gmi|.html|g; s|gemini://|https://|g' \
< $CONTENT_BASE_DIR/gemtext/gemfeed/atom.xml \
> $CONTENT_BASE_DIR/html/gemfeed/atom.xml
-
- git::add "$format" "$CONTENT_BASE_DIR/html/gemfeed/atom.xml"
}
# Internal helper function for generate::fromgmi
@@ -111,8 +108,6 @@ generate::_fromgmi () {
s|%%STYLESHEET_OVERRIDE%%|$stylesheet_override|g;" "$dest.tmp"
mv "$dest.tmp" "$dest"
fi
-
- git::add "$format" "$dest"
}
# Generate a given output format from a Gemtext file.
@@ -124,6 +119,7 @@ generate::fromgmi () {
while read -r src; do
num_gmi_files=$(( num_gmi_files + 1 ))
+ log INFO "Generating output formats from $src"
for format in "$@"; do
generate::_fromgmi "$src" "$format" &
done
@@ -183,14 +179,8 @@ generate::fromgmi () {
# Cleanup HTML extras
rm $CONTENT_BASE_DIR/gemtext/{style.css,*.ttf}
- if [[ -z "$GIT_COMMIT_MESSAGE" ]]; then
- GIT_COMMIT_MESSAGE='Publishing new version'
- fi
- git::commit gemtext "$GIT_COMMIT_MESSAGE"
- git::commit meta "$GIT_COMMIT_MESSAGE"
-
for format in "$@"; do
- git::commit "$format" "$GIT_COMMIT_MESSAGE"
log INFO "$format can be found in $CONTENT_BASE_DIR/$format now"
done
+ log INFO "You may want to commit all changes to version control!"
}
diff --git a/lib/git.source.sh b/lib/git.source.sh
deleted file mode 100644
index c51707b..0000000
--- a/lib/git.source.sh
+++ /dev/null
@@ -1,81 +0,0 @@
-# Git can not run concurrently
-git::_lock () {
- local -r lock="${CONTENT_BASE_DIR}/git.lock"
-
- while test -d $lock; do
- sleep 0.1
- done
- while ! mkdir $lock 2>/dev/null; do
- sleep 0.1
- done
-}
-
-git::_unlock () {
- local -r lock="${CONTENT_BASE_DIR}/git.lock"
- rmdir $lock
- # log DEBUG "Removed $lock"
-}
-
-git::cleanup () {
- local -r lock="${CONTENT_BASE_DIR}/git.lock"
- if [ -d "$lock" ]; then
- git::_unlock
- fi
-}
-
-# Add a static content file to git
-git::add () {
- if [[ "$USE_GIT" != yes ]]; then
- return
- fi
-
- local -r content_dir="$CONTENT_BASE_DIR/$1"; shift
- local file="$1"; shift
- file=${file/$content_dir/.\/}
-
- git::_lock
- cd "$content_dir" &>/dev/null
- git add "$file"
- cd - &>/dev/null
- git::_unlock
-}
-
-# Remove a static content file from git
-git::rm () {
- if [[ "$USE_GIT" != yes ]]; then
- return
- fi
-
- local -r content_dir="$CONTENT_BASE_DIR/$1"; shift
- local file="$1"; shift
- file=${file/$content_dir/.\/}
-
- git::_lock
- cd "$content_dir" &>/dev/null
- git rm "$file"
- cd - &>/dev/null
- git::_unlock
-}
-
-# Commit all changes
-git::commit () {
- if [[ "$USE_GIT" != yes ]]; then
- return
- fi
-
- local -r content_dir="$CONTENT_BASE_DIR/$1"; shift
- local -r message="$1"; shift
-
- git::_lock
- cd "$content_dir" &>/dev/null
- set +e
- git commit -a -m "$message"
- if [[ "$GIT_PUSH" == yes ]]; then
- log INFO "Invoking git pull/push in $content_dir"
- git pull
- git push
- fi
- set -e
- cd - &>/dev/null
- git::_unlock
-}
diff --git a/lib/notes.source.sh b/lib/notes.source.sh
index 559b218..b82631d 100644
--- a/lib/notes.source.sh
+++ b/lib/notes.source.sh
@@ -24,11 +24,15 @@ NOTES
# Extract first heading as post title.
local title=$($SED -n '/^# / { s/# //; p; q; }' \
"$notes_dir/$gmi_file" | tr '"' "'")
-
- echo "=> ./$gmi_file $title" >> \
- "$notes_dir/index.gmi.tmp"
+ echo "=> ./$gmi_file $title" >> "$notes_dir/index.gmi.tmp"
done < <(notes::_get_notes)
+cat <<NOTES >> "$notes_dir/index.gmi.tmp"
+
+That were all notes. Hope they were useful!
+
+=> ../ Go back to main site
+NOTES
+
mv "$notes_dir/index.gmi.tmp" "$notes_dir/index.gmi"
- git::add gemtext "$notes_dir/index.gmi"
}