Skip to content

Commit

Permalink
rails.el (rails-templates-list): added 'html.erb'
Browse files Browse the repository at this point in the history
rails-snippets-feature.el (rails-snippets-feature:rest): replace *_url to *_path
inflections.el (singularize-string pluralize-string): downcase
  string befored searched
inflections.el (pluralize-string singularize-string): downcase
  input string before find in irregular


git-svn-id: svn+ssh://rubyforge.org/var/svn/emacs-rails/trunk@216 cc5033d0-740f-0410-afc7-949910e492f2
  • Loading branch information
dimaexe committed Nov 2, 2007
1 parent 436370c commit 61c3e81
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 342 deletions.
301 changes: 29 additions & 272 deletions ChangeLog

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions History
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SVN
* Removed file 'untabify-file.el' from package emacs-rails
* Updated highlight of compilation output
* Added ruby-mode support in hs-minor-mode (aka folding).
* Added migrations and configuration files to speedbar.
Expand Down
6 changes: 3 additions & 3 deletions inflections.el
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@
(:irregular "sex" "sexes")
(:irregular "move" "moves")

(:uncountable "equipment" "information" "rice" "money" "species" "series" "fish" "sheep"))
(:uncountable "equipment" "information" "rice" "money" "species" "series" "fish" "sheep" "news"))

(defun singularize-string (str)
(when (stringp str)
(or (car (member str inflection-uncountables))
(caar (member* str inflection-irregulars :key 'cadr :test 'equal))
(caar (member* (downcase str) inflection-irregulars :key 'cadr :test 'equal))
(loop for (from to) in inflection-singulars
for singular = (string=~ from str (sub to))
when singular do (return singular))
Expand All @@ -118,7 +118,7 @@
(defun pluralize-string (str)
(when (stringp str)
(or (car (member str inflection-uncountables))
(cadar (member* str inflection-irregulars :key 'car :test 'equal))
(cadar (member* (downcase str) inflection-irregulars :key 'car :test 'equal))
(loop for (from to) in inflection-plurals
for plurals = (string=~ from str (sub to))
when plurals do (return plurals))
Expand Down
3 changes: 2 additions & 1 deletion rails-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ it does not exist, ask to create it using QUESTION as a prompt."

(defun rails-core:controller-file-by-model (model)
(when model
(let ((controller (pluralize-string model)))
(let* ((controller (pluralize-string model))
(controller (when controller (capitalize controller))))
(when (rails-core:controller-exist-p controller)
(rails-core:controller-file controller)))))

Expand Down
2 changes: 1 addition & 1 deletion rails-ruby.el
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ See the variable `align-rules-list' for more details.")
(when (eq 'code (overlay-get ov 'hs))
(overlay-put ov 'face 'font-lock-comment-face)
(overlay-put ov 'display
(format " ··· %d lines"
(format " ... %d lines"
(count-lines (overlay-start ov)
(overlay-end ov))))))

Expand Down
14 changes: 7 additions & 7 deletions rails-snippets-feature.el
Original file line number Diff line number Diff line change
Expand Up @@ -405,25 +405,25 @@
(case action
(:index
(tooltip-show (format "GET /%s" plural))
(format "%s_url" plural))
(format "%s_path" plural))
(:show
(tooltip-show (format "GET /%s/1" plural))
(format "%s_url(%s)" singular model))
(format "%s_path(%s)" singular model))
(:new
(tooltip-show (format "GET /%s/new" plural))
(format "new_%s_url" singular))
(format "new_%s_path" singular))
(:edit
(tooltip-show (format "GET /%s/1;edit" plural))
(format "edit_%s_url(%s)" singular model))
(format "edit_%s_path(%s)" singular model))
(:create
(tooltip-show (format "POST /%s" plural))
(format "%s_url" plural))
(format "%s_path" plural))
(:update
(tooltip-show (format "PUT /%s/1" plural))
(format "%s_url(%s)" singular model))
(format "%s_path(%s)" singular model))
(:destroy
(tooltip-show (format "DELETE /%s/1" plural))
(format "%s_url(%s)" singular model))))))
(format "%s_path(%s)" singular model))))))

(defun rails-snippets-feature:rest-index ()
(rails-snippets-feature:rest :index))
Expand Down
5 changes: 3 additions & 2 deletions rails.el
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ Emacs w3m browser."
:group 'rails
:type 'string)

(defvar rails-version "0.5.99.1")
(defvar rails-templates-list '("erb" "rhtml" "rxml" "rjs" "haml" "liquid" "mab"))
(defvar rails-version "0.5.99.6")
(defvar rails-templates-list '("html.erb" "erb" "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 @@ -446,6 +446,7 @@ necessary."
(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))

(modify-coding-system-alist 'file "\\.rb$" 'utf-8)
(modify-coding-system-alist 'file "\\.rake$" 'utf-8)
Expand Down
56 changes: 0 additions & 56 deletions untabify-file.el

This file was deleted.

0 comments on commit 61c3e81

Please sign in to comment.