Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed the default deploy method and added RSYNC plugin #152

Merged
merged 4 commits into from
Oct 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cli/cli.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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\")
Expand Down
7 changes: 7 additions & 0 deletions docs/plugin-use.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions plugins/rsync.lisp
Original file line number Diff line number Diff line change
@@ -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 ~{~A~^ ~} ~A ~A" *args*
(merge-pathnames staging)
(merge-pathnames (deploy-dir *config*))))

(defun enable (&rest args)
(setf *args* args))
3 changes: 2 additions & 1 deletion src/coleslaw.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
(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."
Expand Down
2 changes: 1 addition & 1 deletion src/config.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
(:default-initargs
:feeds nil
:license nil
:plugins nil
:plugins '((rsync "-avz" "--delete" "--exclude" ".git/" "--exclude" ".gitignore" "--copy-links"))
:sitenav nil
:excerpt-sep "<!--more-->"
:charset "UTF-8"
Expand Down