diff options
author | Patrick Spek <p.spek@tyil.nl> | 2023-03-09 13:47:44 +0100 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2023-03-09 13:47:44 +0100 |
commit | a20eacfd320c6f3144e1e4e598248cdd804d48f4 (patch) | |
tree | 938084ae878c440d28f439d7784c7d1a5da63d52 | |
parent | a67cab04f84bbb75b27e294291e741b2d82ce6f7 (diff) | |
download | www-static-a20eacfd320c6f3144e1e4e598248cdd804d48f4.tar.gz www-static-a20eacfd320c6f3144e1e4e598248cdd804d48f4.tar.bz2 |
Use more local vars
-rw-r--r-- | playbook.bash | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/playbook.bash b/playbook.bash index 1f47ebc..69c0ef0 100644 --- a/playbook.bash +++ b/playbook.bash @@ -1,29 +1,35 @@ #!/usr/bin/env bash BASHTARD_PLAYBOOK_VARS[$BASHTARD_PLAYBOOK.branch]="" -BASHTARD_PLAYBOOK_VARS[$BASHTARD_PLAYBOOK.generator]="" +BASHTARD_PLAYBOOK_VARS[$BASHTARD_PLAYBOOK.generator]="required" BASHTARD_PLAYBOOK_VARS[$BASHTARD_PLAYBOOK.path]="" BASHTARD_PLAYBOOK_VARS[$BASHTARD_PLAYBOOK.remote]="" BASHTARD_PLAYBOOK_VARS[$BASHTARD_PLAYBOOK.repository]="required" playbook_add() { local path + local remote + local repo path="$(config "$BASHTARD_PLAYBOOK.path" "/var/www/$BASHTARD_PLAYBOOK")" + remote="$(config "$BASHTARD_PLAYBOOK.remote" "origin")" + repo="$(config "$BASHTARD_PLAYBOOK.repository")" mkdir -p -- "$path" git -C "$path" init - git -C "$path" remote add "$(config "$BASHTARD_PLAYBOOK.remote" "origin")" "$(config "$BASHTARD_PLAYBOOK.repository")" + git -C "$path" remote add "$remote" "$repo" playbook_sync } playbook_sync() { local branch + local generator local path local remote branch="$(config "$BASHTARD_PLAYBOOK.branch" "master")" + generator="$(config "$BASHTARD_PLAYBOOK.generator")" path="$(config "$BASHTARD_PLAYBOOK.path" "/var/www/$BASHTARD_PLAYBOOK")" remote="$(config "$BASHTARD_PLAYBOOK.remote" "origin")" @@ -32,13 +38,13 @@ playbook_sync() { chgdir "$path" - case "$(config "$BASHTARD_PLAYBOOK.generator")" in + case "$generator" in hugo) hugo -D # This will generate all the draft content hugo # And this will generate the actual live blog, but won't remove the draft content ;; *) - crit "$BASHTARD_PLAYBOOK/sync" "Unsupported generator '$(config "$BASHTARD_PLAYBOOK.generator")'" + crit "$BASHTARD_PLAYBOOK/sync" "Unsupported generator '$generator'" esac } |