blob: c5835d6fc8edc0861f48e059ac050a868c06ef58 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/usr/bin/env bash
playbook_add() {
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() {
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"
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 "$BASHTARD_PLAYBOOK.path" "/var/www/$BASHTARD_PLAYBOOK")"
}
|