Skip to content

Commit

Permalink
rails-ws.el (rails-ws:available-servers-list): Added Thin support.
Browse files Browse the repository at this point in the history
rails.el (rails-templates-list): Added js.rjs and builder templates


git-svn-id: svn+ssh://rubyforge.org/var/svn/emacs-rails/trunk@225 cc5033d0-740f-0410-afc7-949910e492f2
  • Loading branch information
dimaexe committed Mar 2, 2008
1 parent 4b6fba1 commit 0607b85
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 16 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2008-03-03 Dmitry Galinsky <[email protected]>

* rails-ws.el (rails-ws:available-servers-list): Added Thin support.

* rails.el (rails-templates-list): Added js.rjs and builder templates

2008-02-15 Dmitry Galinsky <[email protected]>

* rails-core.el (rails-core:observer-p, rails-core:mailer-p): fixed regexp.
Expand Down
9 changes: 8 additions & 1 deletion rails-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,17 @@
'(rails-test-error
rails-test-trace))
(add-hook 'after-change-functions 'rails-test:print-progress nil t)
(add-hook 'rails-script:run-after-stop-hook 'rails-test:print-result nil t)
(add-hook 'rails-script:run-after-stop-hook 'rails-test:hide-rails-project-root t t)
;; (add-hook 'rails-script:run-after-stop-hook 'rails-test:scroll-of-buffer t t)
(add-hook 'rails-script:run-after-stop-hook 'rails-test:print-result t t)
(add-hook 'rails-script:show-buffer-hook 'rails-test:reset-point-and-height t t))

;; (defun rails-test:scroll-of-buffer ()
;; (with-current-buffer "ROutput"
;; (buffer "ROutput")
;; (goto-char (point-min))
;; (scroll-down-nomark (count-lines (point-min) (point-max)))))

(defun rails-test:hide-rails-project-root ()
"Show files that are relative to the project root as relative filenames
As the buffer is read-only this is merely a change in appearance"
Expand Down
3 changes: 3 additions & 0 deletions rails-ui.el
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@
([rails ws use-mongrel] '(menu-item "Use Mongrel" (lambda() (interactive)
(rails-ws:switch-default-server-type "mongrel"))
:button (:toggle . (rails-ws:default-server-type-p "mongrel"))))
([rails ws use-thin] '(menu-item "Use Thin" (lambda() (interactive)
(rails-ws:switch-default-server-type "thin"))
:button (:toggle . (rails-ws:default-server-type-p "thin"))))
([rails ws separator] '("--"))

([rails ws brows] '(menu-item "Open Browser..." rails-ws:open-browser-on-controller
Expand Down
23 changes: 18 additions & 5 deletions rails-ws.el
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
:type 'string
:tag "Rails Server Type")

(defvar rails-ws:available-servers-list (list "mongrel" "lighttpd" "webrick"))
(defvar rails-ws:available-servers-list (list "mongrel" "lighttpd" "webrick" "thin"))
(defvar rails-ws:buffer-name "*RWebServer*")
(defvar rails-ws:process-environment nil)

Expand Down Expand Up @@ -88,20 +88,33 @@ using `rails-default-environment'."
(message "Only one instance rails-ws allowed")
(let* ((default-directory root)
(env (if env env rails-default-environment))
(command (rails-ws:compute-server-conmmand rails-ws:default-server-type rails-ws:port env))
(proc
(rails-cmd-proxy:start-process rails-ruby-command
rails-ws:buffer-name
rails-ruby-command
(format "script/server %s -p %s -e %s"
rails-ws:default-server-type
rails-ws:port env))))
(car command)
(cadr command))))
(set-process-sentinel proc 'rails-ws:sentinel-proc)
(setq rails-ws:process-environment env)
(message (format "%s (%s) starting with port %s"
(capitalize rails-ws:default-server-type)
env
rails-ws:port)))))))

(defun rails-ws:compute-server-conmmand (server-type port env)
(cond
((string= "thin" server-type)
(list server-type
(format "-p %s -e %s start"
port
env)))
(t
(list rails-ruby-command
(format "script/server %s -p %s -e %s"
server-type
port
env)))))

(defun rails-ws:stop ()
"Stop the WebServer process."
(interactive)
Expand Down
22 changes: 12 additions & 10 deletions rails.el
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Emacs w3m browser."
:type 'string)

(defvar rails-version "0.5.99.6")
(defvar rails-templates-list '("html.erb" "erb" "rhtml" "rxml" "rjs" "haml" "liquid" "mab"))
(defvar rails-templates-list '("html.erb" "erb" "js.rjs" "builder" "rhtml" "rxml" "rjs" "haml" "liquid" "mab"))
(defvar rails-use-another-define-key nil)
(defvar rails-primary-switch-func nil)
(defvar rails-secondary-switch-func nil)
Expand Down Expand Up @@ -437,15 +437,17 @@ necessary."

(autoload 'haml-mode "haml-mode" "" t)

(setq auto-mode-alist (cons '("\\.rb$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.rake$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.mab$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("Rakefile$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.haml$" . haml-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.rjs$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.rxml$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.rhtml$" . html-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.erb$" . html-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.rb$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.rake$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.mab$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("Rakefile$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.haml$" . haml-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.rjs$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.rxml$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.builder$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.rjs$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.rhtml$" . html-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.erb$" . html-mode) auto-mode-alist))

(modify-coding-system-alist 'file "\\.rb$" 'utf-8)
(modify-coding-system-alist 'file "\\.rake$" 'utf-8)
Expand Down

0 comments on commit 0607b85

Please sign in to comment.