branch: externals/ssh-deploy commit 57f8638e081d63f04513aa02b7e6582f355f0113 Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Fixed issue were no run script was defined --- ssh-deploy.el | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/ssh-deploy.el b/ssh-deploy.el index 8635801..1fda4b0 100644 --- a/ssh-deploy.el +++ b/ssh-deploy.el @@ -3,8 +3,8 @@ ;; Author: Christian Johansson <github.com/cjohansson> ;; Maintainer: Christian Johansson <github.com/cjohansson> ;; Created: 5 Jul 2016 -;; Modified: 31 July 2018 -;; Version: 1.95 +;; Modified: 14 Aug 2018 +;; Version: 1.97 ;; Keywords: tools, convenience ;; URL: https://github.com/cjohansson/emacs-ssh-deploy @@ -33,7 +33,8 @@ ;; ssh-deploy enables automatic deploys on explicit-save actions, manual uploads, renaming, ;; deleting, downloads, file and directory differences, launching remote terminals (eshell, shell), -;; detection of remote changes, remote directory browsing, remote SQL database sessions via TRAMP. +;; detection of remote changes, remote directory browsing, remote SQL database sessions and +;; running custom deployment scripts via TRAMP. ;; ;; For asynchrous operations it uses package async.el. ;; @@ -72,6 +73,7 @@ ;; (global-set-key (kbd "C-c C-z B") (lambda() (interactive)(ssh-deploy-browse-remote-handler) )) ;; (global-set-key (kbd "C-c C-z o") (lambda() (interactive)(ssh-deploy-open-remote-file-handler) )) ;; (global-set-key (kbd "C-c C-z m") (lambda() (interactive)(ssh-deploy-remote-sql-mysql-handler) )) +;; (global-set-key (kbd "C-c C-z s") (lambda() (interactive)(ssh-deploy-run-deploy-script-handler) )) ;; ;; - To install and set-up using use-package and hydra do this: ;; (use-package ssh-deploy @@ -93,6 +95,7 @@ ;; _R_: Rename ;; _b_: Browse Base _B_: Browse Relative ;; _o_: Open current file on remote _m_: Open sql-mysql on remote +;; _s_: Run deploy script ;; " ;; ("f" ssh-deploy-upload-handler-forced) ;; ("u" ssh-deploy-upload-handler) @@ -108,7 +111,8 @@ ;; ("b" ssh-deploy-browse-remote-base-handler) ;; ("B" ssh-deploy-browse-remote-handler) ;; ("o" ssh-deploy-open-remote-file-handler) -;; ("m" ssh-deploy-remote-sql-mysql-handler))) +;; ("m" ssh-deploy-remote-sql-mysql-handler) +;; ("s" ssh-deploy-run-deploy-script-handler))) ;; ;; ;; Here is an example for SSH deployment, /Users/Chris/Web/Site1/.dir-locals.el: @@ -125,6 +129,7 @@ ;; (ssh-deploy-root-remote . "/sftp:myu...@myserver.com:/var/www/site2/") ;; (ssh-deploy-on-explicit-save . nil) ;; (ssh-deploy-async . nil) +;; (ssh-deploy-script . (lambda() (let ((default-directory ssh-deploy-root-remote))(shell-command "bash compile.sh")))) ;; ))) ;; ;; Here is an example for FTP deployment, /Users/Chris/Web/Site3/.dir-locals.el: @@ -153,6 +158,7 @@ ;; * `ssh-deploy-remote-sql-user' - Default user when connecting to remote SQL database *(string)* ;; * `ssh-deploy-remote-shell-executable' - Default shell executable when launching shell on remote host ;; * `ssh-deploy-verbose' - Show messages in message buffer when starting and ending actions, default t *(boolean)* +;; * `ssh-deploy-script' - Our custom lambda function that will be called using (funcall) when running deploy script ;; ;; Please see README.md from the same repository for extended documentation. @@ -194,6 +200,7 @@ (put 'ssh-deploy-debug 'permanent-local t) (put 'ssh-deploy-debug 'safe-local-variable 'booleanp) +;; TODO This flag needs to work better, you should not miss any useful notifications when this is on (defcustom ssh-deploy-verbose t "Boolean variable if debug messages should be shown, t by default." :type 'boolean @@ -271,6 +278,13 @@ (put 'ssh-deploy-remote-shell-executable 'permanent-local t) (put 'ssh-deploy-remote-shell-executable 'safe-local-variable 'stringp) +(defcustom ssh-deploy-script nil + "Lambda function to run with `funcall' when `ssh-deploy-run-deploy-script-handler' is executed." + :type 'lambda + :group 'ssh-deploy) +(put 'ssh-deploy-script 'permanent-local t) +(put 'ssh-deploy-script 'safe-local-variable 'funcp) + (defconst ssh-deploy--status-idle 0 "The idle mode-line status.") @@ -1305,12 +1319,22 @@ (let ((root-local (file-truename ssh-deploy-root-local))) (ssh-deploy-browse-remote root-local root-local ssh-deploy-root-remote ssh-deploy-exclude-list)))) +;;;### autoload +(defun ssh-deploy-run-deploy-script-handler () + "Run `ssh-deploy-script' with `funcall'." + (interactive) + (if (and (boundp 'ssh-deploy-script) + ssh-deploy-script) + (funcall ssh-deploy-script) + (display-warning 'ssh-deploy (format "ssh-deploy-script lacks definition!" type) :warning))) + ;;; Menu-bar ;; Creating a new menu pane named Deployment in the menu-bar to the right of “Tools” menu ;; This is particularly useful when key-bindings are not working because of some mode ;; overriding them. + (define-key-after global-map [menu-bar sshdeploy] @@ -1401,6 +1425,15 @@ (define-key global-map + [menu-bar sshdeploy sc] + '("Run script" . ssh-deploy-run-deploy-script-handler)) +(define-key + global-map + [menu-bar sshdeploy sep7] + '("--")) + +(define-key + global-map [menu-bar sshdeploy ulf] '("Forced Upload" . ssh-deploy-upload-handler-forced)) (define-key