Skip to content

Instantly share code, notes, and snippets.

@yoursdearboy
Created February 15, 2017 12:50
Show Gist options
  • Save yoursdearboy/edc88440be7fb50e64cf5860bb53d3a0 to your computer and use it in GitHub Desktop.
Save yoursdearboy/edc88440be7fb50e64cf5860bb53d3a0 to your computer and use it in GitHub Desktop.
Remote Rails console over SSH
;;; rails-console-remote.el --- remote rails console over ssh
;; Copyright (C) 2016 Kirill Voronin <[email protected]>
;; Author: Kirill Voronin <[email protected]>
;; Keywords: rails
;; Version: 0.0.1
(defun rails-console-remote (&optional host &optional path &optional env &optional user-cmd)
"Call `run-ruby'."
(interactive "P")
(let ((default-cmd '"bundle exec rails console"))
(run-ruby
(format "/usr/bin/ssh -t %s cd %s; /bin/bash --login -c '%s %s'"
(or host (read-string "host: "))
(or path (read-string "path: "))
(if user-cmd user-cmd
(read-string "rails console: " default-cmd))
(or env "production")))))
(provide 'rails-console-remote)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment