From 774a29a37271d28e1c961a17dbeca86c1f9d0ad9 Mon Sep 17 00:00:00 2001 From: Masataro Asai Date: Tue, 14 Nov 2017 14:38:24 +0900 Subject: [PATCH 1/4] Removed the default deploy method and added RSYNC plugin --- docs/plugin-use.md | 7 +++++++ plugins/rsync.lisp | 19 +++++++++++++++++++ src/coleslaw.lisp | 4 +++- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 plugins/rsync.lisp diff --git a/docs/plugin-use.md b/docs/plugin-use.md index 735a24a..d653fea 100644 --- a/docs/plugin-use.md +++ b/docs/plugin-use.md @@ -7,6 +7,13 @@ * Available plugins are listed below with usage descriptions and config examples. +## Direct deployment via rsync + +**Description**: This directly sends the contents of the staging dir to the deployed directory. +The former default deployment method. + +**Example**: `(rsync "--exclude" ".git/" "--exclude" ".gitignore" "--copy-links")` + ## Analytics via Google **Description**: Provides traffic analysis through diff --git a/plugins/rsync.lisp b/plugins/rsync.lisp new file mode 100644 index 0000000..319eb6e --- /dev/null +++ b/plugins/rsync.lisp @@ -0,0 +1,19 @@ + +(defpackage :coleslaw-rsync + (:use :cl) + (:import-from :coleslaw #:*config* + #:deploy + #:deploy-dir) + (:export #:enable)) + +(in-package :coleslaw-rsync) + +(defvar *args* nil) + +(defmethod deploy (staging) + (coleslaw::run-program "rsync --delete ~{~A~^ ~} -avz ~A ~A" *args* + (merge-pathnames staging) + (merge-pathnames (deploy-dir *config*)))) + +(defun enable (&rest args) + (setf *args* args)) diff --git a/src/coleslaw.lisp b/src/coleslaw.lisp index d53d2e7..e35129b 100644 --- a/src/coleslaw.lisp +++ b/src/coleslaw.lisp @@ -46,7 +46,9 @@ (defgeneric deploy (staging) (:documentation "Deploy the STAGING build to the directory specified in the config.") (:method (staging) - (run-program "rsync --delete -avz ~a ~a" staging (merge-pathnames (deploy-dir *config*))))) + "By default, do nothing" + (declare))) + (defun update-symlink (path target) "Update the symlink at PATH to point to TARGET." From eacc598930fd0a8fdf4147bda497cced4dbd025d Mon Sep 17 00:00:00 2001 From: Masataro Asai Date: Thu, 16 Nov 2017 14:38:25 +0900 Subject: [PATCH 2/4] as requested (Im not sure) --- src/coleslaw.lisp | 1 - src/config.lisp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/coleslaw.lisp b/src/coleslaw.lisp index e35129b..1517c66 100644 --- a/src/coleslaw.lisp +++ b/src/coleslaw.lisp @@ -49,7 +49,6 @@ "By default, do nothing" (declare))) - (defun update-symlink (path target) "Update the symlink at PATH to point to TARGET." (run-program "ln -sfn ~a ~a" target path)) diff --git a/src/config.lisp b/src/config.lisp index ac65ca8..997e4db 100644 --- a/src/config.lisp +++ b/src/config.lisp @@ -21,7 +21,7 @@ (:default-initargs :feeds nil :license nil - :plugins nil + :plugins '((rsync "--delete")) :sitenav nil :excerpt-sep "" :charset "UTF-8" From dd53a77595d9a25601c949c511a67dc9675ec57b Mon Sep 17 00:00:00 2001 From: Masataro Asai Date: Sun, 27 Oct 2019 14:58:13 -0400 Subject: [PATCH 3/4] move all options to the default-initargs, for maximum customizability --- plugins/rsync.lisp | 2 +- src/config.lisp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/rsync.lisp b/plugins/rsync.lisp index 319eb6e..7ce605e 100644 --- a/plugins/rsync.lisp +++ b/plugins/rsync.lisp @@ -11,7 +11,7 @@ (defvar *args* nil) (defmethod deploy (staging) - (coleslaw::run-program "rsync --delete ~{~A~^ ~} -avz ~A ~A" *args* + (coleslaw::run-program "rsync ~{~A~^ ~} ~A ~A" *args* (merge-pathnames staging) (merge-pathnames (deploy-dir *config*)))) diff --git a/src/config.lisp b/src/config.lisp index 997e4db..9d5a45f 100644 --- a/src/config.lisp +++ b/src/config.lisp @@ -21,7 +21,7 @@ (:default-initargs :feeds nil :license nil - :plugins '((rsync "--delete")) + :plugins '((rsync "-avz" "--delete" "--exclude" ".git/" "--exclude" ".gitignore" "--copy-links")) :sitenav nil :excerpt-sep "" :charset "UTF-8" From a91dcc8075e1dd1d4b48a6c2f7d07e409dced64e Mon Sep 17 00:00:00 2001 From: Masataro Asai Date: Sun, 27 Oct 2019 14:59:54 -0400 Subject: [PATCH 4/4] added rsync to the initial coleslawrc written by setup --- cli/cli.lisp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cli/cli.lisp b/cli/cli.lisp index ab41e7f..495581f 100644 --- a/cli/cli.lisp +++ b/cli/cli.lisp @@ -43,6 +43,8 @@ (sitemap) (static-pages) ; (versioned) ;; *Remove comment to enable symlinked, timestamped deploys. + ;; default deploy method is rsync + (rsync \"-avz\" \"--delete\" \"--exclude\" \".git/\" \"--exclude\" \".gitignore\" \"--copy-links\") ) :sitenav ((:url \"http://~a.github.com/\" :name \"Home\") (:url \"http://twitter.com/~a\" :name \"Twitter\")