Permalink
Browse files

tweaked rinari-sql for more reliable parsing of database.yml, and cha…

…nged indicator file for rinari-merb-root
  • Loading branch information...
1 parent ac80b1f commit 66faee2daf894afa6d3fc75ad8e328fa3b083469 @eschulte eschulte committed Nov 20, 2008
Showing with 12 additions and 3 deletions.
  1. +7 −1 TODO
  2. +3 −1 rinari-merb.el
  3. +2 −1 rinari.el
View
8 TODO
@@ -47,11 +47,17 @@ or even better...
*implemented* if no file is found with a find pair, then keep moving.
-* TODO Merb support [0/3]
+* TODO Merb support [1/4]
:PROPERTIES:
:suggested-by: Jorge Calás Lozano
:END:
+** DONE new Merb Root
+
+I think it's better to rely on config/init.rb that file should be on
+every merb project, merb.thor doesn't, in fact my "library" project
+doesn't have it.
+
** TODO pull into rinari-merb
rinari-merb (minami? why not just rinari-merb? what if someone create a
rinari version for sinatra? sinasi?)
View
@@ -100,7 +100,9 @@
(defun rinari-merb-root (&optional dir home)
(or dir (setq dir default-directory))
- (if (file-exists-p (expand-file-name "merb.thor" dir))
+ (if (file-exists-p (expand-file-name
+ "init.rb"
+ (file-name-as-directory (expand-file-name "config" dir))))
dir
(let ((new-dir (expand-file-name (file-name-as-directory "..") dir)))
(unless (string-match "\\(^[[:alpha:]]:/$\\|^/$\\)" dir)
View
@@ -95,7 +95,7 @@
(defun rinari-parse-yaml ()
(let ((start (point))
- (end (save-excursion (re-search-forward "^$" nil t) (point)))
+ (end (save-excursion (re-search-forward "^[^:]*$" nil t) (point)))
alist)
(while (and (< (point) end)
(re-search-forward "^ *\\(.*\\): \\(.*\\)$" nil t))
@@ -200,6 +200,7 @@ from your conf/database.sql file."
(adapter (or (cdr (assoc "adapter" database-alist)) "sqlite"))
(sql-user (or (cdr (assoc "username" database-alist)) "root"))
(sql-password (or (cdr (assoc "password" database-alist)) ""))
+ (sql-password (if (> (length sql-password) 0) sql-password nil))
(sql-database (or (cdr (assoc "database" database-alist))
(concat (file-name-nondirectory (rinari-root))
"_" environment)))

0 comments on commit 66faee2

Please sign in to comment.