diff options
Diffstat (limited to 'playbooks.d/www-blog/playbook.bash')
-rw-r--r-- | playbooks.d/www-blog/playbook.bash | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/playbooks.d/www-blog/playbook.bash b/playbooks.d/www-blog/playbook.bash index e217e73..c5835d6 100644 --- a/playbooks.d/www-blog/playbook.bash +++ b/playbooks.d/www-blog/playbook.bash @@ -1,24 +1,33 @@ #!/usr/bin/env bash playbook_add() { - git clone https://git.tyil.nl/blog "$(config www.blog.path)" + local path + + path="$(config "$BASHTARD_PLAYBOOK.path" "/var/www/$BASHTARD_PLAYBOOK")" + + mkdir -p -- "$path" + git -C "$path" init + git -C "$path" remote add "$(config "$BASHTARD_PLAYBOOK.remote" "origin")" "$(config "$BASHTARD_PLAYBOOK.repository")" playbook_sync } playbook_sync() { - if [[ $BASHTARD_COMMAND != "add" ]] - then - git -C "$(config www.blog.path)" pull origin "$(config www.blog.branch)" - fi + local branch + local path + local remote + + branch="$(config "$BASHTARD_PLAYBOOK.branch" "master")" + path="$(config "$BASHTARD_PLAYBOOK.path" "/var/www/$BASHTARD_PLAYBOOK")" + remote="$(config "$BASHTARD_PLAYBOOK.origin" "origin")" + + git -C "$path" fetch "$remote" "$branch" + git -C "$path" reset --hard "$remote/$branch" - chgdir "$(config www.blog.path)" 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 } playbook_del() { - rm -fr -- "$(config www.blog.path)" - - pkg uninstall hugo + rm -fr -- "$(config "$BASHTARD_PLAYBOOK.path" "/var/www/$BASHTARD_PLAYBOOK")" } |