Permalink
Browse files

Use "bundle exec" when available for rspec and starting the webserver.

  • Loading branch information...
remvee committed Sep 13, 2012
1 parent cea70da commit ada41e886ea1c99685b6733316f548f4823fcf3b
Showing with 14 additions and 10 deletions.
  1. +5 −0 rails-core.el
  2. +1 −2 rails-rake.el
  3. +2 −2 rails-spec.el
  4. +6 −6 rails-ws.el
View
@@ -866,4 +866,9 @@ the Rails minor mode log."
"Return non nil if spec directory is exist."
(file-exists-p (rails-core:file "spec")))
+(defun rails-core:prepare-command (command)
+ (if (and rails-rake-use-bundler-when-possible (file-exists-p (rails-core:file "Gemfile")))
+ (concat "bundle exec " command)
+ command))
+
(provide 'rails-core)
View
@@ -138,7 +138,6 @@
(interactive) (rails-rake:task "db:test:clone"))
(defun rails-rake:rake-command (&optional args)
- (if (and rails-rake-use-bundler-when-possible (file-exists-p (rails-core:file "Gemfile")))
- (concat "bundle exec rake " args) (concat "rake " args)))
+ (rails-core:prepare-command (concat "rake " args)))
(provide 'rails-rake)
View
@@ -30,8 +30,8 @@
(defun rails-spec:runner ()
"Command, that run specs."
(if (file-exists-p (rails-core:file "script/spec"))
- (rails-core:file "script/spec")
- "rspec"))
+ (rails-core:file "script/spec")
+ (rails-core:prepare-command "rspec")))
(defvar rails-spec:last-run nil
"Spec and arguments of last run.")
View
@@ -94,7 +94,7 @@ using `rails-default-environment'."
(run-hooks 'rails-ws:before-start-hook)
(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))
+ (command (rails-ws:compute-server-command rails-ws:default-server-type rails-ws:port env))
(proc
(rails-cmd-proxy:start-process-color rails-ruby-command
rails-ws:buffer-name
@@ -108,13 +108,13 @@ using `rails-default-environment'."
rails-ws:port)))
(run-hooks 'rails-ws:after-start-hook))))))
-(defun rails-ws:compute-server-conmmand (server-type port env)
+(defun rails-ws:compute-server-command (server-type port env)
(cond
((string= "thin" server-type)
- (list server-type
- (format "-p %s -e %s start"
- port
- env)))
+ (list (rails-core:prepare-command server-type)
+ (format "-p %s -e %s start"
+ port
+ env)))
((file-exists-p (rails-core:file "script/rails"))
(list rails-ruby-command
(format "script/rails server -p %s -e %s"

0 comments on commit ada41e8

Please sign in to comment.