Так как я новичок в rails (и в emacs), я не хочу сразу использовать rinari. Я обнаружил, что если инструмент творит слишком много магии для меня, я не изучаю детали так быстро, как хотелось бы. Я думаю, что я буду использовать это в конце концов. На данный момент, однако, я установил кучу оболочек, которые я создаю в emacs для RAILS 3, и просто переключаюсь между ними для выполнения моей работы. Я добавляю к ним префикс tmr, чтобы их было легко найти.
(defun tmr-spork-shell ()
"Invoke spork shell" ; Spork - love that name
(interactive)
(pop-to-buffer (get-buffer-create (generate-new-buffer-name "spork")))
(shell (current-buffer))
(process-send-string nil "cd .\n"); makes sure rvm variables set with .rvmrc
(process-send-string nil "spork\n"))
(defun tmr-devlog-shell ()
"Tail the development log, shell"
(interactive)
(pop-to-buffer (get-buffer-create (generate-new-buffer-name "devlog")))
(shell (current-buffer))
(process-send-string nil "cd .\n"); makes sure rvm variables set with .rvmrc
(process-send-string nil "tail -f log/development.log\n"))
(defun tmr-testlog-shell ()
"Tail the test log, shell"
(interactive)
(pop-to-buffer (get-buffer-create (generate-new-buffer-name "testlog")))
(shell (current-buffer))
(process-send-string nil "cd .\n"); makes sure rvm variables set with .rvmrc
(process-send-string nil "tail -f log/test.log\n"))
(defun tmr-server-shell ()
"Invoke rails ui server shell"
(interactive)
(pop-to-buffer (get-buffer-create (generate-new-buffer-name "server")))
(shell (current-buffer))
(process-send-string nil "cd .\n"); makes sure rvm variables set with .rvmrc
(process-send-string nil "rails s\n"))
(defun tmr-db-shell ()
"Invoke rails dbconsole shell"
(interactive)
(pop-to-buffer (get-buffer-create (generate-new-buffer-name "dbconsole")))
(shell (current-buffer))
(process-send-string nil "cd .\n"); makes sure rvm variables set with .rvmrc
(process-send-string nil "rails dbconsole\n"))
(defun tmr-console-shell ()
"Invoke rails console shell"
(interactive)
(pop-to-buffer (get-buffer-create (generate-new-buffer-name "console")))
(shell (current-buffer))
(process-send-string nil "cd .\n"); makes sure rvm variables set with .rvmrc
(process-send-string nil "rails console\n"))
; I like to run all my tests in the same shell
(defun tmr-rspec-shell ()
"Invoke rspec shell"
(interactive)
(pop-to-buffer (get-buffer-create (generate-new-buffer-name "rspec")))
(shell (current-buffer))
(process-send-string nil "cd .\n"); makes sure rvm variables set with .rvmrc
(process-send-string nil "rspec spec\n")) ; This is debatable, since spork wont be up yet
; The shell where I do most of my work
(defun tmr-shell ()
"Invoke plain old shell"
(interactive)
(pop-to-buffer (get-buffer-create (generate-new-buffer-name "sh")))
(shell (current-buffer))
(process-send-string nil "cd .\n")); makes sure rvm variables set with .rvmrc
; My everyday ide
(defun tmr-ide-lite ()
"Spawn several shells for a mini Rails IDE"
(interactive)
(progn (tmr-spork-shell)
(tmr-shell)
(tmr-server-shell)
(tmr-rspec-shell)))
; When I am doing a big debug session
(defun tmr-ide-full ()
"Spawn several shells for a full Rails IDE"
(interactive)
(progn (tmr-spork-shell)
(tmr-shell)
(tmr-server-shell)
(tmr-console-shell)
(tmr-db-shell)
(tmr-devlog-shell)
(tmr-testlog-shell)
(tmr-rspec-shell)))