diff options
| author | Paul Buetow <git@mx.buetow.org> | 2021-05-19 20:01:47 +0100 |
|---|---|---|
| committer | Paul Buetow <git@mx.buetow.org> | 2021-05-21 05:11:05 +0100 |
| commit | 14822623456972b0dbe9dc5b6c36b701bb6ec7f1 (patch) | |
| tree | 75ff9e661c682b7bad6aa2dc59eb12ad5622ef6b /packages | |
| parent | afd9fdf7ca0800c457959b540c4378d20f802dc0 (diff) | |
Removal of Makefile and some fixes/refactorings
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/assert.source.sh | 12 | ||||
| -rw-r--r-- | packages/generate.source.sh | 7 | ||||
| -rw-r--r-- | packages/git.source.sh | 22 |
3 files changed, 30 insertions, 11 deletions
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 } |
