From 61aeed196b412ca0c57a8b7a52593215752f1e37 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 20 May 2021 08:40:59 +0100 Subject: some log bugfixing, also add another alternate config file path --- README.md | 7 +++++-- buetow.org.sh | 2 ++ packages/git.source.sh | 13 +++---------- packages/log.source.sh | 1 + 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index d3f48a8c..220ad77f 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ You will notice soon, that all site content is located in `../buetow.org-content ### Alternative config file path -If you don't want to mess with `buetow.org.conf`, you can use an alternative config file path by setting the `CONFIG_FILE_PATH` environment variable, e.g.: +If you don't want to mess with `buetow.org.conf`, you can use an alternative config file path in `~/.config/buetow.org.conf`, which takes precedence if it exists. Another way is to set the `CONFIG_FILE_PATH` environment variable, e.g.: ``` export CONFIG_FILE_PATH=~/.config/my-site.geek.conf @@ -88,6 +88,8 @@ And the following will additionally perform a `git pull` and `git push` afterwar USE_GIT=yes GIT_PUSH=yes ./buetow.org --generate ``` +You could add the `USE_GIT` and `GIT_PUSH` options to the `buetow.org.conf` config file too. + ## Finito After running `./buetow.org --genreate` you will have all static files ready to be published. But before you do that you could preview the content with `firefox ../buetow.org-content/html/index.html` or `glow ../buetow.org-content/md/index.md` (you get the idea). @@ -100,6 +102,7 @@ Now it is up to you to setup a Gemini server for the Gemtext, a Webserver for th These are things I want to do with this project in near future: -* Write a blog post about buetow.org.sh script * Custom alt.buetow.org domain for GitHub page. * Test + fix on macOS (I havn't tested it for macOS fully yet) +* Write a blog post about buetow.org.sh script +* Once blog post published request buetow.org.sh to be added to the Awesome Gemini list. diff --git a/buetow.org.sh b/buetow.org.sh index 60113e10..a1f312b6 100755 --- a/buetow.org.sh +++ b/buetow.org.sh @@ -18,6 +18,8 @@ set -e if [[ -n "$CONFIG_FILE_PATH" ]]; then source "$CONFIG_FILE_PATH" +elif [[ -f ~/.config/buetow.org.conf ]]; then + source ~/.config/buetow.org.conf else source ./buetow.org.conf fi diff --git a/packages/git.source.sh b/packages/git.source.sh index 9ee238cc..ca1f4750 100644 --- a/packages/git.source.sh +++ b/packages/git.source.sh @@ -26,20 +26,13 @@ git::commit () { local -r message="$1"; shift 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 - cd - &>/dev/null -} - -# Commit all changes -git::commit () { - local -r content_dir="$CONTENT_BASE_DIR/$1"; shift - local -r message="$1"; shift - - cd "$content_dir" &>/dev/null - git commit -a -m "$message" + set -e cd - &>/dev/null } diff --git a/packages/log.source.sh b/packages/log.source.sh index 2c6e1b3f..56c6587e 100644 --- a/packages/log.source.sh +++ b/packages/log.source.sh @@ -1,6 +1,7 @@ # Log a message. log () { local -r level="$1"; shift + local message for message in "$@"; do echo "$message" -- cgit v1.2.3