public
Description: Rinari Is Not A Rails IDE
Homepage: http://rinari.rubyforge.org
Clone URL: git://github.com/technomancy/rinari.git
first commit, code is workable but not ready for public use.changes 
include
Eric Schulte (author)
Fri Jun 13 12:07:01 -0700 2008
commit  9aab13768a13ffb78d138cc89331f53f45e9c39f
tree    d0d0421055bc98a87fdecb1eecb24aa160412c5f
parent  94ef572fce505920ca8d154d629298e92dab5e91
0
...
16
17
18
19
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
16
17
18
 
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
0
@@ -16,4 +16,20 @@ Copies of ruby-mode.el, inf-ruby.el, and other dependencies have been
0
 included for convienience, but may be out of date. Nxhtml-mode is not
0
 included because it's rather large, so you should download it here:
0
 
0
- http://ourcomments.org/Emacs/nXhtml/doc/nxhtml.html
0
\ No newline at end of file
0
+ http://ourcomments.org/Emacs/nXhtml/doc/nxhtml.html
0
+
0
+One possible .init file for nxhtml in rinari would be
0
+
0
+;;; nxml (rhtml support)
0
+(load "~/emacs/elisp/nxml/autostart.el")
0
+
0
+(setq
0
+ nxhtml-global-minor-mode t
0
+ mumamo-chunk-coloring 'submode-colored
0
+ nxhtml-skip-welcome t
0
+ indent-region-mode t
0
+ rng-nxml-auto-validate-flag nil
0
+ nxml-degraded t
0
+ )
0
+
0
+
...
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
127
128
...
64
65
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
0
@@ -64,65 +64,62 @@
0
 
0
 ;;; Code:
0
 
0
-(require 'project-local-variables)
0
-
0
-(defvar ffip-regexp
0
- (concat ".*\\.\\(" (mapconcat (lambda (x) x) '("rb" "rhtml" "el") "\\|") "\\)")
0
- "Regexp of things to look for when using find-file-in-project.")
0
-
0
-(defvar ffip-find-options
0
- ""
0
- "Extra options to pass to `find' when using find-file-in-project.
0
-
0
-Use this to exclude portions of your project: \"-not -regex \\\".*vendor.*\\\"\"")
0
-
0
-(defvar ffip-project-root nil
0
- "If non-nil, overrides the project root directory location.")
0
-
0
-(defun ffip-project-files ()
0
- "Return an alist of all filenames in the project and their path.
0
-
0
-Files with duplicate filenames are suffixed with the name of the
0
-directory they are found in so that they are unique."
0
- (let ((file-alist nil))
0
- (mapcar (lambda (file)
0
- (let ((file-cons (cons (file-name-nondirectory file)
0
- (expand-file-name file))))
0
- (when (assoc (car file-cons) file-alist)
0
- (ffip-uniqueify (assoc (car file-cons) file-alist))
0
- (ffip-uniqueify file-cons))
0
- (add-to-list 'file-alist file-cons)
0
- file-cons))
0
- (split-string (shell-command-to-string (concat "find " (or ffip-project-root
0
- (ffip-project-root))
0
- " -type f -regex \""
0
- ffip-regexp
0
- "\" " ffip-find-options))))))
0
-
0
-(defun ffip-uniqueify (file-cons)
0
- "Set the car of the argument to include the directory name plus the file name."
0
- (setcar file-cons
0
- (concat (car file-cons) ": "
0
- (cadr (reverse (split-string (cdr file-cons) "/"))))))
0
-
0
-(defun find-file-in-project ()
0
- "Prompt with a completing list of all files in the project to find one.
0
-
0
-The project's scope is defined as the first directory containing
0
-an `.emacs-project' file. You can override this by locally
0
-setting the `ffip-project-root' variable."
0
- (interactive)
0
- (let* ((project-files (ffip-project-files))
0
- (file (if (functionp 'ido-completing-read)
0
- (ido-completing-read "Find file in project: "
0
- (mapcar 'car project-files))
0
- (completing-read "Find file in project: "
0
- (mapcar 'car project-files)))))
0
- (find-file (cdr (assoc file project-files)))))
0
-
0
-(defun ffip-project-root (&optional dir)
0
- "Find the root of the project defined by presence of `.emacs-project'."
0
- (file-name-directory (plv-find-project-file default-directory "")))
0
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
0
+;;; find-file-in-project
0
+
0
+(defvar rinari-project-files-table ())
0
+
0
+(defvar ffip-subdirectories
0
+ '("app" "config" "db" "lib" "public/javascripts" "public/stylesheets"))
0
+
0
+(defun populate-project-files-table (file)
0
+ (if (file-directory-p file)
0
+ (mapc 'populate-project-files-table (directory-files file t "^[^\.]"))
0
+ (let* ((file-name (file-name-nondirectory file))
0
+ (existing-record (assoc file-name project-files-table))
0
+ (unique-parts (get-unique-directory-names file (cdr existing-record))))
0
+ (if existing-record
0
+ (let ((new-key (concat file-name " - " (car unique-parts)))
0
+ (old-key (concat (car existing-record) " - " (cadr unique-parts))))
0
+ (setf (car existing-record) old-key)
0
+ (setq project-files-table (acons new-key file project-files-table)))
0
+ (setq project-files-table (acons file-name file project-files-table))))))
0
+
0
+(defun get-unique-directory-names (path1 path2)
0
+ (let* ((parts1 (and path1 (split-string path1 "/" t)))
0
+ (parts2 (and path2 (split-string path2 "/" t)))
0
+ (part1 (pop parts1))
0
+ (part2 (pop parts2))
0
+ (looping t))
0
+ (while (and part1 part2 looping)
0
+ (if (equal part1 part2)
0
+ (setq part1 (pop parts1) part2 (pop parts2))
0
+ (setq looping nil)))
0
+ (list part1 part2)))
0
+
0
+(defun find-file-in-project (file)
0
+ (interactive (list (if (or (equalp ido-mode 'file)
0
+ (equalp ido-mode 'both))
0
+ (ido-completing-read "Find file in project: "
0
+ (mapcar 'car (project-files)))
0
+ (completing-read "Find file in project: "
0
+ (mapcar 'car (project-files))))))
0
+ (find-file (cdr (assoc file project-files-table))))
0
+
0
+;; TODO: revert to the .emacs-project version with a defadvice wrapper
0
+;; for rails-root
0
+(defun project-files (&optional file)
0
+; uncomment these lines if it's too slow to load the whole project-files-table
0
+; (when (or (not project-files-table) ; initial load
0
+; (not (string-match (rails-root) (cdar project-files-table)))) ; switched projects
0
+ (setq project-files-table nil)
0
+ (if file
0
+ (populate-project-files-table file)
0
+ (let ((root (rails-root)))
0
+ (mapc (lambda (dir)
0
+ (populate-project-files-table (concat root "/" dir)))
0
+ ffip-subdirectories)))
0
+ project-files-table)
0
 
0
 (provide 'find-file-in-project)
0
 ;;; find-file-in-project.el ends here
...
220
221
222
223
224
225
 
226
227
228
...
220
221
222
 
223
224
225
226
227
228
0
@@ -220,9 +220,9 @@ to continue it."
0
   (use-local-map inferior-ruby-mode-map)
0
   (setq comint-input-filter (function ruby-input-filter))
0
   (setq comint-get-old-input (function ruby-get-old-input))
0
- (compilation-shell-minor-mode t)
0
   (make-local-variable 'compilation-error-regexp-alist)
0
   (setq compilation-error-regexp-alist inferior-ruby-error-regexp-alist)
0
+ (compilation-shell-minor-mode t)
0
   (run-hooks 'inferior-ruby-mode-hook))
0
 
0
 (defvar inferior-ruby-filter-regexp "\\`\\s *\\S ?\\S ?\\s *\\'"
...
47
48
49
 
 
 
50
51
52
...
55
56
57
58
59
60
 
61
62
63
...
72
73
74
75
76
77
78
79
80
81
...
131
132
133
 
134
135
136
137
 
 
 
 
 
 
 
 
138
139
140
...
47
48
49
50
51
52
53
54
55
...
58
59
60
 
61
62
63
64
65
66
...
75
76
77
 
 
 
 
78
79
80
...
130
131
132
133
134
135
136
 
137
138
139
140
141
142
143
144
145
146
147
0
@@ -47,6 +47,9 @@
0
 
0
 ;; Name functions consistently
0
 ;; Make rinari a minor mode that doesn't activate for regular ruby-mode.
0
+;; make `rails-find-action' work with rails2-style view filenames
0
+;; make `rails-find-action' which will follow forms (maybe w/prefix?)
0
+;; add key-bindings for rinari minor mode
0
 
0
 ;;; Code:
0
 
0
@@ -55,9 +58,9 @@
0
 (require 'inf-ruby)
0
 (require 'toggle)
0
 
0
-(require 'project-local-variables)
0
 (require 'find-file-in-project)
0
 (require 'pcmpl-rake)
0
+(require 'rails-scripts)
0
 
0
 ;;;###autoload
0
 (defun rake (task)
0
@@ -72,10 +75,6 @@
0
     (unless (equal dir "/")
0
       (rails-root (expand-file-name (concat dir "../"))))))
0
 
0
-(defun rails-console ()
0
- (interactive)
0
- (run-ruby (concat (rails-root) "script/console")))
0
-
0
 (defun rails-find-view ()
0
   "View toggling for rails"
0
   (interactive)
0
@@ -131,10 +130,18 @@
0
   (insert " %>")
0
   (backward-char 3))
0
 
0
+;; keymaps
0
 (define-key ruby-mode-map (kbd "C-c C-v") 'rails-find-view)
0
 (define-key ruby-mode-map (kbd "C-c C-t") 'toggle-buffer)
0
 (define-key ruby-mode-map (kbd "C-c C-M-t") 'ruby-test-file)
0
-;;(define-key ruby-mode-map (kbd "C-c C-S-t") 'ruby-test-one)
0
+(define-key ruby-mode-map (kbd "C-c C-S-t") 'ruby-test-one)
0
+;;
0
+;; some temporary keymaps (will replace when have minor-mode)
0
+;;
0
+;; ("Key Binding Conventions" node of the Elisp manual)
0
+(define-key ruby-mode-map (kbd "C-c v s") 'rails-script)
0
+(define-key ruby-mode-map (kbd "C-c v w") 'rails-script-server)
0
+(define-key ruby-mode-map (kbd "C-c v c") 'rails-script-console)
0
 
0
 ;; nxhtml-mode is the cats!
0
 (eval-after-load 'nxhtml-mode

Comments

    No one has commented yet.