From 774a29a37271d28e1c961a17dbeca86c1f9d0ad9 Mon Sep 17 00:00:00 2001 From: Masataro Asai Date: Tue, 14 Nov 2017 14:38:24 +0900 Subject: [PATCH] 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."