summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <git@mx.buetow.org>2021-05-19 20:01:47 +0100
committerPaul Buetow <git@mx.buetow.org>2021-05-21 05:11:05 +0100
commit14822623456972b0dbe9dc5b6c36b701bb6ec7f1 (patch)
tree75ff9e661c682b7bad6aa2dc59eb12ad5622ef6b
parentafd9fdf7ca0800c457959b540c4378d20f802dc0 (diff)
Removal of Makefile and some fixes/refactorings
-rw-r--r--Makefile18
-rwxr-xr-xbuetow.org.sh15
-rw-r--r--packages/assert.source.sh12
-rw-r--r--packages/generate.source.sh7
-rw-r--r--packages/git.source.sh22
5 files changed, 45 insertions, 29 deletions
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 681a9c96..00000000
--- a/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-all: generate
-generate:
- git submodule init
- git submodule update
- bash ./buetow.org.sh --generate
-publish:
- USE_GIT=yes ./buetow.org.sh --generate
- git commit -a
- git push
-test: shellcheck
- LOG_VERBOSE=yes ./buetow.org.sh --test
-shellcheck:
- shellcheck \
- --norc \
- --external-sources \
- --check-sourced \
- --exclude=SC2155,SC2010,SC2154,SC1090,SC2012 \
- buetow.org.sh
diff --git a/buetow.org.sh b/buetow.org.sh
index 7f63c9d8..da8a99d7 100755
--- a/buetow.org.sh
+++ b/buetow.org.sh
@@ -62,14 +62,29 @@ main () {
case $arg in
--test)
+ LOG_VERBOSE=yes
+ assert::shellcheck
html::test
md::test
;;
--feed)
+ assert::shellcheck
+ html::test
+ md::test
gemfeed::generate
atomfeed::generate
;;
--generate)
+ assert::shellcheck
+ html::test
+ md::test
+ gemfeed::generate
+ atomfeed::generate
+ generate::fromgmi html md
+ ;;
+ --publish)
+ USE_GIT=yes
+ assert::shellcheck
html::test
md::test
gemfeed::generate
diff --git a/packages/assert.source.sh b/packages/assert.source.sh
index 5d3a5c5d..0c7157f3 100644
--- a/packages/assert.source.sh
+++ b/packages/assert.source.sh
@@ -45,3 +45,15 @@ assert::matches () {
log VERBOSE "Matching in $callee as expected"
}
+
+# Checks if all the Bash scripts here are good.
+assert::shellcheck () {
+ set -e
+ shellcheck \
+ --norc \
+ --external-sources \
+ --check-sourced \
+ --exclude=SC2155,SC2010,SC2154,SC1090,SC2012 \
+ ./"$0"
+ set +e
+}
diff --git a/packages/generate.source.sh b/packages/generate.source.sh
index 25c292f4..b28d9e8e 100644
--- a/packages/generate.source.sh
+++ b/packages/generate.source.sh
@@ -134,7 +134,14 @@ generate::fromgmi () {
done
done
+ if [[ -z "$GIT_COMMIT_MESSAGE" ]]; then
+ GIT_COMMIT_MESSAGE='Publishing new version'
+ fi
for format in "$@"; do
+ git::commit "$format" "$GIT_COMMIT_MESSAGE"
log INFO "$format can be found in $CONTENT_BASE_DIR/$format now"
done
+
+ git::commit gemtext "$GIT_COMMIT_MESSAGE"
+ git::commit meta "$GIT_COMMIT_MESSAGE"
}
diff --git a/packages/git.source.sh b/packages/git.source.sh
index 1484e93d..ec8e8539 100644
--- a/packages/git.source.sh
+++ b/packages/git.source.sh
@@ -2,22 +2,22 @@
git::add () {
local -r content_dir="$CONTENT_BASE_DIR/$1"; shift
local file="$1"; shift
- file=${file/$content_dir/}
+ file=${file/$content_dir/.\/}
- cd $content_dir
- echo git add $file
- cd -
+ cd "$content_dir" &>/dev/null
+ git add "$file"
+ cd - &>/dev/null
}
# Remove a static content file from git
git::rm () {
local -r content_dir="$CONTENT_BASE_DIR/$1"; shift
local file="$1"; shift
- file=${file/$content_dir/}
+ file=${file/$content_dir/.\/}
- cd $content_dir
- echo git rm $file
- cd -
+ cd "$content_dir" &>/dev/null
+ git rm "$file"
+ cd - &>/dev/null
}
# Commit all changes
@@ -25,7 +25,7 @@ git::commit () {
local -r content_dir="$CONTENT_BASE_DIR/$1"; shift
local -r message="$1"; shift
- cd $content_dir
- echo git commit -a -m "$message"
- cd -
+ cd "$content_dir" &>/dev/null
+ git commit -a -m "$message"
+ cd - &>/dev/null
}