diff --git a/_scripts/sh/create_pages.sh b/_scripts/sh/create_pages.sh index 5e675fd..6e152d1 100755 --- a/_scripts/sh/create_pages.sh +++ b/_scripts/sh/create_pages.sh @@ -45,6 +45,7 @@ read_tags() { init() { + if [[ -d categories ]]; then rm -rf categories fi @@ -53,6 +54,10 @@ init() { rm -rf tags fi + if [[ ! -d _posts ]]; then + exit 0 + fi + mkdir categories tags } @@ -130,6 +135,7 @@ create_pages() { main() { + init for _file in $(ls "_posts") diff --git a/_scripts/sh/dump_lastmod.sh b/_scripts/sh/dump_lastmod.sh index ab45706..1190e60 100755 --- a/_scripts/sh/dump_lastmod.sh +++ b/_scripts/sh/dump_lastmod.sh @@ -19,6 +19,7 @@ OUTPUT_FILE=updates.yml _init() { + if [[ ! -d "$OUTPUT_DIR" ]]; then mkdir "$OUTPUT_DIR" fi @@ -27,7 +28,9 @@ _init() { rm -f "$OUTPUT_DIR/$OUTPUT_FILE" fi - touch "$OUTPUT_DIR/$OUTPUT_FILE" + if [[ ! -d $POST_DIR ]]; then + exit 0 + fi } @@ -55,6 +58,10 @@ _has_changed() { _dump() { local _lasmod="`git log -1 --pretty=%ad --date=iso $2`" + if [[ ! -f "$OUTPUT_DIR/$OUTPUT_FILE" ]]; then + touch "$OUTPUT_DIR/$OUTPUT_FILE" + fi + echo "-" >> "$OUTPUT_DIR/$OUTPUT_FILE" echo " filename: '$1'" >> "$OUTPUT_DIR/$OUTPUT_FILE" echo " lastmod: '$_lasmod'" >> "$OUTPUT_DIR/$OUTPUT_FILE" diff --git a/tools/publish.sh b/tools/publish.sh index 9378d61..4917d9f 100755 --- a/tools/publish.sh +++ b/tools/publish.sh @@ -19,7 +19,7 @@ check_status() { local _change=$(git status . -s) if [[ ! -z ${_change} ]]; then - echo "Warning: Commit the changes of the changes first:" + echo "Warning: Commit the following changes first:" echo "$_change" exit 1 fi