Previous: Run Create, Up: Run Create and Update [Index]
The command-line utility update-org-template
is run from within a directory
containing an out-dated Org template project. It deletes the file’s "Build
Tools" and "Buid Scripts" subtrees and replaces them with those from the main
template file.
(require 'org) (message "Update Org Template...") ;(message "Obtaining ORG_SYNC_TEMPLATE: %S..." (getenv "SYNC_ORG_TEMPLATE")) (org-babel-tangle-file (getenv "SYNC_ORG_TEMPLATE")) ;(message "obtained.") (load-file "/usr/local/dev/bin/org-template.el") (setq old-template (car (file-expand-wildcards "*.org" t))) ;(message (format "loaded old-template: %s" old-template)) (setq org-template-version (org-template-version)) ;(message (format "org-template-version: %s" org-template-version)) (message "Checking for s3-bucket: %s..." (org-template-bucket)) (add-key-value "bucket" (org-template-bucket)) ;(add-s3-bucket (org-template-bucket)) (message "Checking for `macro upload-date'") (add-key-value "macro" "upload-date (eval (current-time-string))") ;(message "done") ;(message "Adding pv to build-tools...") (add-pv-to-hl old-template "Build Tools" "custom_id" "build-tools") ;(message "done.") ;(message "Replacing build-tools...") (replace-build-tools "build-tools") ;(message "done.") ;(message "Adding template version to Makefile...") (add-pv-to-hl old-template "Makefile" "org-template-version" org-template-version) ;(message "done.") ;(message "Adding pb build-scripts...") (when (find-hl (get-file-buffer old-template) "Build Scripts") (add-pv-to-hl old-template "Build Scripts" "custom_id" "build-scripts") ;(message "done.") ;(message "Deleting build-scripts...") (delete-build-tools "build-scripts")) ;(message "done.") (org-babel-tangle-file old-template) (message "Finished Update Org Template.")