Skip to content

Instantly share code, notes, and snippets.

@ivey
Created October 7, 2008 07:40
Show Gist options
  • Save ivey/15249 to your computer and use it in GitHub Desktop.
Save ivey/15249 to your computer and use it in GitHub Desktop.
(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)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment