summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2015-10-07 17:03:27 +0000
committerSean Whitton <spwhitton@spwhitton.name>2015-10-11 03:09:56 +0000
commit4297f8f9ebfb36e0acf84f20e5e627454aeee7f5 (patch)
tree610be9219277a79578cb2969fc984cb12f558140
parent971866ee24da7669842d95e2e1be129fcd38b9e8 (diff)
downloaddotfiles-4297f8f9ebfb36e0acf84f20e5e627454aeee7f5.tar.gz
ma_org_publish replaces philosnotes and spwwiki scripts
-rw-r--r--.config/cron/spw/ma.sdf.org9
-rwxr-xr-xbin/ma_org_publish56
-rwxr-xr-xbin/philosnotes44
-rwxr-xr-xbin/spwwiki23
4 files changed, 59 insertions, 73 deletions
diff --git a/.config/cron/spw/ma.sdf.org b/.config/cron/spw/ma.sdf.org
index b33ac667..313806be 100644
--- a/.config/cron/spw/ma.sdf.org
+++ b/.config/cron/spw/ma.sdf.org
@@ -3,12 +3,9 @@
*/15 * * * * chronic doccheckin
@hourly chronic mbsync fastmail
-# update Org wiki at 7am and 2pm MST
-0 14 * * * chronic spwwiki
-0 21 * * * chronic spwwiki
-
-# update philosophy notes more frequently
-1 * * * * chronic philosnotes
+# update Org wiki & philosophy notes at 7am and 2pm MST
+0 14 * * * chronic ma_org_publish
+0 21 * * * chronic ma_org_publish
0 18 * * * duply-run
0 3 * * * chronic planetnewspipe
diff --git a/bin/ma_org_publish b/bin/ma_org_publish
new file mode 100755
index 00000000..277803d4
--- /dev/null
+++ b/bin/ma_org_publish
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+. $HOME/.shenv
+
+set -e
+
+lisp=$(cat <<EOF
+(progn
+ (org-batch-store-agenda-views)
+ (org-publish-project "spw-wiki")
+ (org-publish-project "philos")
+ (org-publish-project "spw-org")
+ (org-publish-project "spw-static")
+ (org-publish-project "blog"))
+EOF
+ )
+
+# assume throughout we're on the MetaArray
+[ "$(hostname -f)" = "ma.sdf.org" ] \
+ || ( echo >&2 "run this script only on MetaArray"; exit 1 )
+
+# 1. git update
+
+# Thanks to `set -e' above, any failure to fast-forward will mean I
+# get an e-mail from crond telling me to resolve the merge.
+for dir in "$HOME/doc $HOME/doc/www $HOME/doc/www/blog"; do
+ cd $dir
+ git pull --ff-only
+done
+
+# 2. prepare publishing destinations
+
+# this is why this script cannot be executed locally!
+mkdir -p $HOME/lib/fm
+# [ "$(ls -A $HOME/lib/fm)" ] \
+# && echo >&2 "target dir not empty!" && exit 1
+
+# 3. have Org publish
+
+emacs -batch \
+ -l $HOME/.emacs.d/init.el \
+ -l $HOME/.emacs.d/init-org.el \
+ -eval "$lisp"
+
+# 4. cleanup
+
+# TODO: factor this publishing via cadaver out into a shell function
+cd $HOME/lib/fm/"Philos notes"
+files="./*"
+cadaver https://myfiles.messagingengine.com/ <<EOF
+cd "Philos notes"
+mput $files
+EOF
+rm -r $HOME/lib/fm/*
+
+rdate.py-dir $HOME/html/blog/entries
diff --git a/bin/philosnotes b/bin/philosnotes
deleted file mode 100755
index 5971d0b0..00000000
--- a/bin/philosnotes
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/bash
-
-. $HOME/.shenv
-
-set -e
-
-# 1. set up publishing locations
-
-if which mount.davfs >/dev/null; then
- if ! [ -d "$HOME/lib/fm/Philos notes" ]; then
- mount $HOME/lib/fm
- unmount="yes"
- else
- unmount="no"
- fi
-else
- mkdir -p $HOME/lib/fm
- [ "$(ls -A $HOME/lib/fm)" ] && echo "target dir not empty!" && exit 1
-fi
-
-# 2. update git if on metaarray
-
-[ "$(hostname -f)" = "ma.sdf.org" ] && cd $HOME/doc && doccheckin && git pull --ff-only
-
-# 3. have Emacs do the publishing
-
-emacs -batch \
- -l $HOME/.emacs.d/init.el \
- -l $HOME/.emacs.d/init-org.el \
- -eval '(org-publish-project "philos")' 2>/dev/null
-
-# 4. tear down publishing locations
-
-if which mount.davfs >/dev/null; then
- [ "$unmount" = "yes" ] && fusermount -u $HOME/lib/fm
-else
- cd $HOME/lib/fm/"Philos notes"
- files="./*"
- cadaver https://myfiles.messagingengine.com/ <<EOF
-cd "Philos notes"
-mput $files
-EOF
- rm -r $HOME/lib/fm/*
-fi
diff --git a/bin/spwwiki b/bin/spwwiki
deleted file mode 100755
index 1ab7a62e..00000000
--- a/bin/spwwiki
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-
-set -e
-
-case "$(hostname -f)" in
- "ma.sdf.org")
- cd $HOME/doc
- git pull --ff-only # if can't fast forward, chronic should
- # e-mail the failed git to me
-
- cd $HOME
- /usr/pkg/bin/emacs -batch -l $HOME/.emacs.d/init.el \
- -l $HOME/.emacs.d/init-org.el \
- -f spw/export-org-wiki \
- -eval "(org-batch-store-agenda-views)"
- ;;
- "artemis.silentflame.com")
- cd $HOME
- emacs -batch -l $HOME/.emacs.d/init.el \
- -l $HOME/.emacs.d/init-org.el \
- -eval '(org-publish-project "spw-wiki")' 2>/dev/null
- ;;
-esac