Created
October 24, 2008 15:20
-
-
Save ivey/19453 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun merb-console (app host user &optional env working-dir) | |
"Connect to a remote host and run merb" | |
(interactive) | |
(require 'inf-ruby) | |
(let ((buffer-name-for-comint (concat app "-console")) | |
(buffer-name (concat "*" app "-console*")) | |
(env (if env env "production")) | |
(working-dir (if working-dir working-dir | |
(concat "/data/" app "/current"))) | |
(cmdlist `("ssh" ,host "-t" | |
,(concat "sudo su -l " user " sh -c 'cd " | |
working-dir " && merb -i -e " env "'")))) | |
(if (not (comint-check-proc buffer-name)) | |
(set-buffer (apply 'make-comint buffer-name-for-comint | |
(car cmdlist) nil (cdr cmdlist))) | |
(inferior-ruby-mode)) | |
(pop-to-buffer buffer-name))) | |
(defun divvs-console () | |
(interactive) | |
(merb-console "divvs" "sh01.divvs.com" "divvs" | |
"production" "/apps/divvs/current")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment