diff options
| author | Paul Buetow <git@mx.buetow.org> | 2021-05-19 20:19:52 +0100 |
|---|---|---|
| committer | Paul Buetow <git@mx.buetow.org> | 2021-05-21 05:11:05 +0100 |
| commit | d354a3ffb999c27ece66f8a66dfb416e5d5d7b6c (patch) | |
| tree | f82ea12f1636eb86f5d088aff80f401f979469dc | |
| parent | 202f4e03fb9519931142fcd3d76700aeb106a05d (diff) | |
add GIT_PUSH
| -rw-r--r-- | README.md | 5 | ||||
| -rwxr-xr-x | buetow.org.sh | 25 | ||||
| -rw-r--r-- | packages/git.source.sh | 14 |
3 files changed, 27 insertions, 17 deletions
@@ -22,7 +22,7 @@ This is the source code of my Gemini capsule. You can reach the site(s) here: # Usage -To get started just clone this repo (master branch) and run ./buetow.org.sh. You +To get started just clone this repo (master branch) and run `./buetow.org.sh`. You will will be prompted with further instructions. Once done, you can edit the Gemtext source and then use the buetow.org.sh script @@ -32,7 +32,7 @@ to generate the other output formats such as: * Markdown (works also with GitHub pages as you saw) * Meta (that's only generating meta info for the blog post, used for Atom feed generation) -Do a ./buetow.org.sh --help for a list of all available arguments. +Do a `./buetow.org.sh --help` for a list of all available arguments. ## TODO @@ -41,3 +41,4 @@ These are things I want to do with this project in near future: * Speed it up a bit: Make it so, that only changed .gmi files (or changed HTML templates) result into re-generating other formats. * Write a blog post about buetow.org.sh script * Custom alt.buetow.org domain for GitHub page. +* Read through this README and make sure usage and purpose is clear. diff --git a/buetow.org.sh b/buetow.org.sh index ecb70711..4c18334f 100755 --- a/buetow.org.sh +++ b/buetow.org.sh @@ -28,11 +28,13 @@ help () { cat <<HELPHERE $0's possible arguments: --feed Generates Gemtext Atom feed and Gemfeed. - --generate Generates all known output formats (html, md, ...) - --publish Same as --generate, but also commits all files to git (and - removes obsolete files form git too). + --generate Generates all known output formats (html, md, ...). + If USE_GIT=yes set, all files will be commited to git too. + If GIT_PUSH=yes is set, all content will be pushed to origin. --test Only runs some shellcheck and unit tests. --help Prints this retty text. +Example: + USE_GIT=yes GIT_PUSH=yes $0 --generate HELPHERE } @@ -47,11 +49,13 @@ The content base directory, does not exist. Run the following to create: Once done, you are ready to edit the files in $CONTENT_BASE_DIR/gemtext. Every time you want to generate other formats from Gemtext (e.g. HTML, Markdown), run -the $0 script again. + ./buetow.org.sh --generate +again. Pro tip: You could make all the directories in $CONTENT_BASE_DIR separate git -repositories or branches. - +repositories or branches. You can then run + USE_GIT=yes ./buetow.org.sh --generate +so that all static files are commited to the content repositories too. END exit 1 fi @@ -84,15 +88,6 @@ main () { atomfeed::generate generate::fromgmi html md ;; - --publish) - USE_GIT=yes - assert::shellcheck - html::test - md::test - gemfeed::generate - atomfeed::generate - generate::fromgmi html md - ;; --help|*) help ;; diff --git a/packages/git.source.sh b/packages/git.source.sh index ec8e8539..9ee238cc 100644 --- a/packages/git.source.sh +++ b/packages/git.source.sh @@ -27,5 +27,19 @@ git::commit () { cd "$content_dir" &>/dev/null git commit -a -m "$message" + if [[ "$GIT_PUSH" == yes ]]; then + git pull + git push + fi + cd - &>/dev/null +} + +# Commit all changes +git::commit () { + local -r content_dir="$CONTENT_BASE_DIR/$1"; shift + local -r message="$1"; shift + + cd "$content_dir" &>/dev/null + git commit -a -m "$message" cd - &>/dev/null } |
