Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Commit

Permalink
Fixed compilation warnnings.
Browse files Browse the repository at this point in the history
Added  a key :after-load-bundles in `rails/defbundle'.
  • Loading branch information
dmexe committed Mar 7, 2009
1 parent 0d90efe commit 5222f7f
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 100 deletions.
1 change: 1 addition & 0 deletions CHANGES
@@ -1,5 +1,6 @@
== HEAD
*) Feature: added the snippets for yasnippets.
*) Bugfix: compilation warnnings.

== 0.99 Changes (5 Mar 2009)
First release.
Expand Down
4 changes: 1 addition & 3 deletions bundles/rails-database-bundle.el
Expand Up @@ -36,7 +36,7 @@
(rails/notify
(if (zerop retval) ,success ,failed))))

(defun rails/database-bundle/run-task (root task &optional funcs args)
(defun rails/database-bundle/run-task (root task &optional args funcs)
"Run a Database task in RAILS_ROOT with MAJOR-MODE."
(when (and task root)
(unless funcs
Expand Down Expand Up @@ -65,7 +65,6 @@
(rails/database-bundle/run-task
root
"migrate"
nil
(format "VERSION=%s" (car (split-string version " "))))))))

(defun rails/database-bundle/migrate-rollback ()
Expand All @@ -78,7 +77,6 @@
(rails/notify "Invalid step, muste be digits.")
(rails/database-bundle/run-task root
"rollback"
nil
(format "STEP=%s" steps))))))

(defun rails/database-bundle/migrate-redo ()
Expand Down
4 changes: 2 additions & 2 deletions bundles/rails-generator-bundle.el
Expand Up @@ -93,7 +93,7 @@
(if task
(let (options)
(unless (string-ext/empty-p task)
(setq options (read-string (format "Name and/or options for [%s]: " task)))
(setq options (read-string (format "script/generate %s " task)))
(unless (string-ext/empty-p options)
(rails/generator-bundle/run (rails/root)
"generate"
Expand All @@ -109,7 +109,7 @@
(if task
(let (options)
(unless (string-ext/empty-p task)
(setq options (read-string (format "Name of [%s]: " task)))
(setq options (read-string (format "script/destroy %s " task)))
(unless (string-ext/empty-p options)
(rails/generator-bundle/run (rails/root) "destroy" task options))))
(rails/anything/run-with-pattern "des "))))
Expand Down
37 changes: 19 additions & 18 deletions bundles/rails-rspec-bundle.el
Expand Up @@ -2,7 +2,7 @@
;;; - Variables
;;;

(setq rails/rspec-bundle/command rails/ruby/command)
(defvar rails/rspec-bundle/command rails/ruby/command)
(defvar rails/rspec-bundle/spec-options "-O spec/spec.opts")

;;; ---------------------------------------------------------
Expand All @@ -28,31 +28,32 @@

(defun rails/rspec-bundle/run-spec-task (root task args)
(rails/compile/run root
rails/rake-bundle/command
(if (boundp 'rails/rake-bundle/command)
rails/rake-bundle/command
"rake")
(format "%s %s" task (if args args ""))))

(defun rails/rspec-bundle/after-load ()
(when (boundp 'rails/rake-bundle/tasks-runners-alist)
(add-to-list 'rails/rake-bundle/tasks-runners-alist
'("^spec" . rails/rspec-bundle/run-spec-task)))
(setq rails/compile/single-file-list
(cons 'rails/rspec-bundle/single-file
rails/compile/single-file-list))
(setq rails/compile/current-method-list
(cons 'rails/rspec-bundle/current-method
rails/compile/current-method-list)))

;;; ---------------------------------------------------------
;;; - Bundle
;;;

(rails/defbundle "RSpec"
(:menu
(([method] (cons "Run Current Mehtod" 'rails/compile/current-method))
([file] (cons "Run Single File" 'rails/compile/single-file))))

;;; ---------------------------------------------------------
;;; - Setup tests
;;;

(setq rails/compile/single-file-list
(cons 'rails/rspec-bundle/single-file
rails/compile/single-file-list))
(setq rails/compile/current-method-list
(cons 'rails/rspec-bundle/current-method
rails/compile/current-method-list))
([file] (cons "Run Single File" 'rails/compile/single-file)))
:after-load-bundles
'rails/rspec-bundle/after-load)

(add-to-list 'rails/rake-bundle/tasks-runners-alist
'("^spec" . rails/rspec-bundle/run-spec-task))
;;; ---------------------------------------------------------
;;; - Resources
;;;
Expand Down Expand Up @@ -96,4 +97,4 @@
:file-pattern "{name}/.*"
:file-ext "rb"
:options 'expand-in-menu
:test-to 'view ))
:test-to 'view ))
34 changes: 18 additions & 16 deletions bundles/rails-test-unit-bundle.el
Expand Up @@ -21,31 +21,33 @@

(defun rails/test-unit-bundle/run-test-task (root task args)
(rails/compile/run root
rails/rake-bundle/command
(if (boundp 'rails/rake-bundle/command)
rails/rake-bundle/command
"rake")
(format "%s %s" task (if args args ""))))

;;; ---------------------------------------------------------
;;; - Bundle
;;;

(rails/defbundle "Test::Unit"
(:menu
(([method] (cons "Run Current Mehtod" 'rails/compile/current-method))
([file] (cons "Run Single File" 'rails/compile/single-file))))

;;; ---------------------------------------------------------
;;; - Setup tests
;;;

(defun rails/test-unit-bundle/after-load ()
(setq rails/compile/single-file-list
(cons 'rails/test-unit-bundle/single-file
rails/compile/single-file-list))
(setq rails/compile/current-method-list
(cons 'rails/test-unit-bundle/current-method
rails/compile/current-method-list))

(add-to-list 'rails/rake-bundle/tasks-runners-alist
'("^test" . rails/test-unit-bundle/run-test-task))
(when (boundp 'rails/rake-bundle/tasks-runners-alist)
(add-to-list 'rails/rake-bundle/tasks-runners-alist
'("^test" . rails/test-unit-bundle/run-test-task))))

;;; ---------------------------------------------------------
;;; - Bundle
;;;

(rails/defbundle "Test::Unit"
(:menu
(([method] (cons "Run Current Mehtod" 'rails/compile/current-method))
([file] (cons "Run Single File" 'rails/compile/single-file)))
:after-load-bundles
'rails/test-unit-bundle/after-load)

;;; ---------------------------------------------------------
;;; - Resources
Expand Down
8 changes: 7 additions & 1 deletion rails-bundles.el
Expand Up @@ -29,6 +29,7 @@
(defvar rails/bundles/loaded-list nil)
(defvar rails/bundles/loaded-p nil)
(defvar rails/bundles/trigger-list nil)
(defvar rails/bundles/after-load-list nil)

(defconst rails/bundles/file-regexp "^rails-\\(.*\\)-bundle\.el$")
(defconst rails/bundles/name-fmt "rails/%s-bundle/name")
Expand Down Expand Up @@ -59,13 +60,15 @@
(intern (format rails/bundles/name-fmt sym)))))
(add-to-list 'rails/bundles/loaded-list (cons sym title))
(rails/bundles/add-to-loaded-menu title))))
(mapc 'funcall rails/bundles/after-load-list)
(setq rails/bundles/loaded-p t)))

(defun rails/bundles/reload ()
(interactive)
(setq rails/bundles/loaded-list nil)
(setq rails/bundles/loaded-p nil)
(setq rails/bundles/trigger-list nil)
(setq rails/bundles/after-load-list nil)
(rails/resources/clear)
(rails/bundles/load))

Expand Down Expand Up @@ -93,7 +96,7 @@
(cons (concat title " Bundle") menumap)
'bundles-title))

(defmacro* rails/defbundle (name (&key menu keys triggers) &body body)
(defmacro* rails/defbundle (name (&key menu keys triggers after-load-bundles) &body body)
`(progn
(defconst
,(intern (format rails/bundles/name-fmt (string-ext/safe-symbol name)))
Expand All @@ -109,6 +112,9 @@
,@(loop for tr in triggers
collect
`(add-to-list 'rails/bundles/trigger-list ',tr)))
(when ,(not (not after-load-bundles))
(setq rails/bundles/after-load-list
(cons ,after-load-bundles rails/bundles/after-load-list)))
(when ,(not (not keys))
,@(loop for (key func) in keys collect
`(rails/define-key ,key ,func)))
Expand Down

0 comments on commit 5222f7f

Please sign in to comment.